Reputation: 1121
Am trying to write generic code for all the resolutions. Being a new developer am getting stopped by this font issue. Consider am having various resolutions ( 100 * 100, 200 * 200, 300 * 300 etc ).Am having a textview if suppose i set the font size as 20 for 100*100, when i am porting this code to 200*200, the size of the font seems to be very small for the resolution 200*200. Could any plz tell how to calculate font size for various regions. Is there any formual available to calculate it.. plz advise.. thanks in advance...
Upvotes: 1
Views: 8262
Reputation: 14027
Try using sp
unit for your font size.
sp
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 user's preference.
More information here
Take sometime reading this to understand the different measurement units used in Andriod as well.
Upvotes: 6