Reputation: 1447
I have been struggling with this problem about a week and can not figure out how to make it work. I have some views on a screen. And one values\dimens.xml(sw320dp-xxhdpi)
resource file. Also I have nexus 5.2 1080*1920 420dpi
and nexus 5.0 1080*1920 xxhdpi
. The layout appears differently on both screens. How to make it display the same on each device?
What resource file should I add (if it is any)?
How to add for example values\dimens.xml(1080*1920 420dpi)
?
Upvotes: 0
Views: 123
Reputation: 13353
How to make it display the same on each device?
In general it's impossible for all Android devices. I think best solution - using VectorDrawable
or SVG
format and scale vectors for each device.
Upvotes: 0
Reputation: 41498
I think your layout is simply built as poorly scaling. Unless you have some very specific use case, you need to make sure your layout fills the area it is provided with regardless.
As for the resource folder, if you want to make sure the same layout file is used on large screens, it is enough to put it in the folder layout-sw360dp
. If you have xxhdpi devices with the resolution 1080x1920, Android will select the same file for both since the smallest side will be exactly 1080 / 3 = 360 density-independent pixels.
Upvotes: 2