Do I have to create a Values / dimens.xml for each types of screen in android?

1

I have all these measures:

  • 7 "screens - mdpi
  • 3.2 "screens - mdpi.

Therefore I try to create directories for each type of screen, but not all respond to their respective description, for example, in the case of tablets that are 1024px and are mdpi I programmed values for values-sw320dp-mdpi, values- sw480dp-mdpi.

Should I do the same for each and every screen case? If that were the case ... How would you have to name these directories according to their description so that they can be rendered with their respective measurements?

How should I name the dimens.xml files to be suitable for each type of screen?

    
asked by Gean BCone Angulo 29.01.2017 в 17:42
source

1 answer

0

If you require another dimension measurement in another density, add the dimens.xml file, in the corresponding density folder:

/values-sw320dp-mdpi

/values-sw480dp-mdpi 

And add the corresponding entry to the measure that the operating system will automatically take.

<resources>
    <dimen name="mi_medida">56dp</dimen>
</resources>

This value will be taken automatically by your layout or view depending on the density of the device.

android:layout_width="@dimen/mi_medida"

Currently in Stackoverflow in Spanish there are related questions:

answered by 29.01.2017 в 18:58