0

I have a problem, in my app I have a lot of text, the app work correct but if a device have the text settings set on huge, all the text off the app are cut. How can i solve the problem? Can the app ignore the text dimension setting?

Thanks

simox89
  • 43
  • 6

1 Answers1

0

Try to set your textsize in px or dp. Use dp if you want to set sizes via xml, because when using pxs you'll face a problem of different screen sizes. Problem with screen sizes can be eliminated with some calculations. E.g. you set size in px for your device and set device's screen settings as etalon. Every new device will have its screen settings and your px sizes should be recomputed based on etalon.

In my project I use this https://gist.github.com/togramago/dfccc387452ccffb0d16 . Text fonts are measured for their height via this https://gist.github.com/togramago/8bde02d30267106d6de0 . Use as:

DimenManager dimen = ((MyApplication) getApplication()).getDimenManager();
ViewUtils.setTextViewSize(myTextView, dimen.getHeight(35));

In my project, DimenManager is a singleton in MyApplication, so it is initialized only once:

dimenManager = DimenManager.getDimenManager();
dimenManager.setup(getApplicationContext());
Margarita Litkevych
  • 2,086
  • 20
  • 28