0

I have a problem with text size in 5.7" phone or 1440 x 2560 pixel phone I tried 2 phone, one is LG V10 and another is Samsung Galaxy Note 5. This 2 phone is same in resolution and screen size but the result of text size is different. In Samsung galaxy note 5 the text size is looks good but in LG V10 is terrible

I use this code to calculate text size in different screen size

Point size = new Point();
getWindowManager().getDefaultDisplay().getSize(size); 
float percent = .18f;
textView.setTextSize(percent * size.x);

Please help me what is the best way to calculate text size in different resolution

Dirus
  • 1,033
  • 2
  • 14
  • 21

1 Answers1

1

Try using sp unit for your font size.

Scale-independent Pixels - This is like the dp unit, but it is also scaled by the user's font size preference. It is recommend you use this unit when specifying font sizes, so they will be adjusted for both the screen density and the user's preference. Ref.

Prem Kumar
  • 73
  • 1
  • 8
  • Thank for the answer but using sp is worse than using percent like what I use, I already try to use sp but in small device is terrible – Dirus Jan 14 '16 at 05:34