5
votes

I'm facing the next problem:

I have a values-xxhdpi with their dimensions.xml. Devices with 480 dpi work great with this folder.

The problem is that for example Samsung Galaxy S4 or S5 catch the values from this folder and not look well in screen because they have a 420 dpi. So I need to create a values-SOMETHING to this type or devices.

I try adding values-w410dp and work fine, but if I add this folder the devices with 480 dpi now catch de values from this folder and not the values from the values-xxhdpi.

Please need sugestions

Thanks

1
values-w410dp has nothing to do with screen density. I would focus instead on designing a more flexible UI, where the small difference between 420dpi and 480dpi is not an issue. - CommonsWare
"I need that the button matches de background" -- and there is your mistake. That approach will not be reliable, as you have no means of ensuring that those things will line up. - CommonsWare
@CommonsWare I understand. What i don't understand is why a device with 1080*1920 5,0'' (Nexus 5) is xxhdpi and 1080*1920 5,1'' (Samsung Galaxy S5) is 420dpi. All images in the Samsung S5 are smaller! - user3240604
does anyone have solution for this? This also happens with xhdpi res too; as there are two variants for xhdpi 720*1280 and 768*1280. this minor difference of 48px can disturb views aligned with background. - Dhaval Patel
Any update on this? 2019 anyone? - shanraisshan

1 Answers

5
votes

You have to create dimension resource files for different screen sizes with different dpi.

As you can see here:

android:screenSize=   ["small"| "normal" | "large" |     "xlarge"     ]

android:screenDensity=["ldpi" |   "mdpi" | "hdpi"  | "xhdpi"| "xxhdpi"]

            dpi   [ "280" | "360"| "420"| "480" | "560" ] 

Add your screen dimension with density and define your attributes.