2

So I have probably uncommon situation, I change Font size in settings under accessibility to huge and it changes font size through all apps. In my app it just ruins all UI. So my questions are:

  • Can I prevent resizing in my app?
  • Can I somehow adapt UI that it wouldn't push things around when fonts increasing in size?
  • How professionals deals with this situation?
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
LeTadas
  • 3,436
  • 9
  • 33
  • 65
  • 1
    **(1)** We cannot stop the user from changing the device font size, but we can use dp for dimensions to avoid unwanted UI distortion. You can refer: https://developer.android.com/training/multiscreen/screendensities.html#TaskUseDP. **(2)** I found this question on StackOverflow and found it helpful, refer: https://stackoverflow.com/questions/6786439/how-to-set-font-scale-in-my-own-android-application. **(3)** Professional developers also follow these concepts and build great apps! – ManmeetP Nov 08 '17 at 10:55

2 Answers2

1

In your app do not use sp for your font sizes in order your app's font sizes to be the same, after changing font sizes from your phone settings. I think this answer also could help you: What is the difference between “px”, “dip”, “dp” and “sp”?

Hope I answered your question ;).

SnkTay
  • 71
  • 2
  • 13
0

Yes, you can prevent resizing in app. Just add the below code under your activity tag in your Manifest:

android:configChanges="fontScale"

For example :

<activity
  android:name=".MainActivity"    
  android:configChanges="fontScale"
  ....
  ..../>
Rakesh
  • 1,205
  • 1
  • 14
  • 33