-3

I am using font size percentage 0.96f which is floating point. On different devices I might want higher font size percent. How do I store this as a resource? I suppose I could store as 95 and divide by 100 but anyway how do you store floating point numbers in resource file which might give different value depending on device resolution/size etc. just like for layout files. If you are curious about the percent its because I am reducing the size of the font by 4% to fit a TextView onto my view. Soon there will be in Android O a new TextView to do the scaling but not now.

Thanks

Jaydeep Devda
  • 727
  • 4
  • 18
gitsensible
  • 551
  • 1
  • 8
  • 19

1 Answers1

0

To get different integer based on device resolution from resource, you have to add Different values folder for different screens in res directory. For ex: - values - values-small - values-large - values-sw600dp

Add dimens.xml in every values folder and add dimensions according to resolution.

16dp

Harshal Shah
  • 427
  • 3
  • 5