K
K
kirawa2014-08-29 08:07:50
Android
kirawa, 2014-08-29 08:07:50

How to set font sizes in Android?

Good morning. Please help me once and for all with the dimensions in androyd. Now I'm trying to make the font display the same on all devices. I am writing a calculator. I need the field to fit 12 digits and I used this code:

public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        updateSizeInfo();
    }
    private void updateSizeInfo() {
        float h = txtTablo.getHeight();
        txtTablo.setTextSize(h / 1.9f);
    }

Everything suited me so well, it was displayed as it should on several devices, but then I launched it on the Genymotion emulator and everything became very bad. (Maybe you shouldn't trust him?)
Probably it's better to set the sizes in resources for each resolution. Please tell me the size ratio. Please, in simple and Russian

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kirawa, 2014-08-29
@kirawa

I created 4 folders in them a file and a size in the file, but something is not displayed
correctly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question