Reputation: 65
I am trying to understand how to use multiple layouts for different screens sizes properly.
I made two layouts: default and large for bt_control.xml
I own galaxy s8+ device so I made a virtual device with the same specs. The android studio recognize it as a "large" device as seen here:
But when I upload the app to my phone it display the default screen size layout (not the large). what could be the reason for that?
Upvotes: 0
Views: 133
Reputation: 473
Your question is a complex one, but the short answer is that Android has different screen types and sizes, and therefore the determining factor on which resource gets used are:
Android looks at your Pixel density and determines which resource to use (if you specified any resources for large or small devices). But for this to work, you need to follow the localization and resource qualifier precedence. An example below:
Which Resource Takes Precedence?
I recommend you take a look at Localization , Alternative Resource and Different Screen Densities. If your folder qualifiers are not setup correctly, Android will ignore these resources and use the default one. Your resource folder should look something like this:
res/
drawable <- default
drawable-ldpi <- Alternative resources for low to large pixel densities
drawable-mdpi
drawable-hdpi
drawable-xhdpi
drawable-xxhdpi
drawable-xxxhdpi
values-sw600dp/
values-fr/ <- Values for french resources
layout/ <- Layout default
layout-land/ <- Alternative layout for landscape orientation
You can also Google these if the Android Developer Guide is too vague for you. I hope this helps
Upvotes: 1
Reputation: 137
I'm not sure. But "large" means litle near to tablets, phones with a large density screen or so.
Instead of use "large". Use hdpi, xhdpi, xxhdpi and xxxhdpi.
By using xhdpi or higher your phone will use them.
Upvotes: 1