12

I am developing an Android Application and I would like to read the Font Size under Settings->Display->Font Size.

So if a user has set his Font Size to Small/Big/Huge, I would like to apply this automaticly to all my text

I am using a Samsung Galaxy Nexus, Android 4.1.2

Thank you in advance for your help

Luke94
  • 712
  • 5
  • 14

2 Answers2

11

Try reading FONT_SCALE from android.provider.Settings.System.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
3

You can also define your text size using "sp" units which is the same like "dp" but scales according to the users system setting for text size. No need to read the font size from the system yourself.

Hokascha
  • 1,709
  • 1
  • 23
  • 41
  • It may be useful when you have separate layouts for larger texts – pkuszewski Jun 20 '17 at 08:19
  • This should be the correct answer for the question, although `FONT_SCALE` was what I was looking for. When creating layouts, you should almost always use `sp` for fonts – Gibolt Nov 14 '17 at 19:29