How to specify padding based on screen size

I am developing an action plan for Android (simple form). I want to specify the indentation between the various editing texts in a linear layout depending on the screen size.

The larger the screen, the more I want to display the elements separated (to avoid scrolling).

It is clear? Thanks.

+4
source share
1 answer

You can specify the sizes:

values:

<dimen name="padding">10dp</dimen> 
folder

values-sw400:

 <dimen name="padding">14dp</dimen> 

And so on.

Now you just need to specify the addition as follows:

 android:padding="@dimen/padding" 
+3
source

Source: https://habr.com/ru/post/1500806/


All Articles