Home > other >  How to let app layout not changed by Display size and font size by Android system setting?
How to let app layout not changed by Display size and font size by Android system setting?

Time:09-23

How to fix default display size and font size in app prevent user change system setting lead to app layout out of shape?

enter image description here

enter image description here

Before Display Scale larger

After Display Scale larger

xml layout

CodePudding user response:

If you use the dp (like 20dp) instead of sp (like 20sp), the text will not be scaled based on the user choice of the font size. This will simplify the UI design for you, but users make the font big for a reason: they cannot see the smaller one. So if you choose to ignore the user's settings, the user may choose to ignore your app.

CodePudding user response:

Make sure you have used sp in the textSize attribute in your layout XML file. Text size in the sp unit can adjust itself according to android system settings.

For e.g-

..
android:textSize="14sp"
..

Also, you can check out this reference- https://stackoverflow.com/a/2025541/10632119

There are some plugins and library are available for Android Studio i.c.- "com.intuit.sdp:sdp-android", Dimenify, which will generate multiple dimems.xml files for our project according to screen density.

CodePudding user response:

There are below things that you have to do,

  1. Use the SP for textSize with appropriate dimension values, (or use the SDP library)
  2. Use the chat box image as scalable vector image.

CodePudding user response:

Use the implementation com.intuit.sdp:sdp-android:1.0.6. It will resize according to the screen size.

  • Related