2

Currently, I am developing one android app so in that, I need to implement such functionality that prevents layout scaling whenever user change display size from the android device setting app. enter image description here

I am using the below library for font size and view size. For font size https://github.com/intuit/ssp For view size https://github.com/intuit/sdp

Faldu Jaldeep
  • 545
  • 2
  • 15

1 Answers1

0

if you need your text to fix size for all screens, you'll have to use dp.

Here is the documentation.

To preserve the visible size of your UI on screens with different densities, you must design your UI using density-independent pixels (dp) as your unit of measurement. One dp is a virtual pixel unit that's roughly equal to one pixel on a medium-density screen (160dpi; the "baseline" density). Android translates this value to the appropriate number of real pixels for each other density.

Sunny
  • 3,134
  • 1
  • 17
  • 31
  • My friend I am using DP for view size and SP for text size this is basic. – Faldu Jaldeep Dec 03 '19 at 10:05
  • Yes, If you want to fix the size of the text for the app change sp -> dp. Because `sp` will be changed if you make the changing from the setting to large fonts. To prevent this you need to define the text size in dp's – Sunny Dec 03 '19 at 10:11
  • 1
    Font scaling is working fine I just need to fix layout size scaling. – Faldu Jaldeep Dec 03 '19 at 10:31
  • @FalduJaldeep you mean to say "ssp" and "sdp" (which are libraries) here, not sp and dp. – Mike Jan 09 '23 at 21:30