Reputation: 417
I'm developing an app for API 14 or above. I have to use folder like this:
drawable-ldpi,
drawable-hdpi,
drawable-xxxhdpi,
layout-ldpi,
layout-xxxhdpi
OR
drawable-sw320dp,
drawable-sw720dp,
layout-sw320dp,
layout-sw720dp.
Don't know which have better screen support for cellphones and tablets.
Thanks.
Upvotes: 0
Views: 424
Reputation: 1489
You should consider multiple variables: screen size, screen density, orientation.
The easiest way to differentiate cellphones or tablets is to use size qualifiers (check video).
But easiest may be not the best, so you have to play with all qualifiers.
A good video with explanation about resource selection logic.
Upvotes: 1
Reputation: 67189
The key to understanding which to use is understanding what they resource qualifiers mean.
The density qualifiers (e.g. ldpi, hdpi, xhdpi) specify resources that change based on the density of pixels in the device's screen. This is useful for resources such as images- you typically want your images to be the same physical size on all devices, meaning you need a higher density ("bigger") image on higher density devices.
The size qualifiers (e.g. sw720dp, s2320dp) specify resources that change based on the physical size of the device. This is useful if you want to specify that some content on screen should change sizes (or location) based on the screen size. For example, you may want to swap out a list of items on a 4" device for a grid of items on a 7" device.
Generally the density qualifiers are used for drawables since you want higher density drawables on higher density devices, and the size qualifiers are used for layouts since you may want to adjust your layouts to better take advantage of different screen sizes.
The two are not, however, mutually exclusive. You can use either qualifier (and many more) with any type of resource to fit your needs. The first step is identifying what you want to do on different devices, then identifying the proper resource qualifiers to achieve your goals.
Upvotes: 3