Answer the question
In order to leave comments, you need to log in
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);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question