tony9099
tony9099

Reputation: 4717

Samsung Galaxy S3 and HTC Sensation use the wrong layout file

Both Samsung Galaxy S3 and HTC Sensation fit the category of layout-sw360dp.

Galaxy s3 > (720/320) x 160 = 360

Sensation > (540/240) x 160 = 360

However, when I try creating a layout folder layout-w540dp-h960dp. It does not read from it and instead it reads from the folder layout-sw360dp.

How to prevent this and make each load within its specific layout ? and why layout-w540dp-h960dp does not work ?

Upvotes: 0

Views: 482

Answers (1)

Renjith
Renjith

Reputation: 5803

This is because layout-sw<N>dp has got higher precedence than layout-w<N>dp.

In Android, resources folder qualifiers are selected according to a specific precedence rules. Have a look at this table. It specifies all the available configuration qualifiers which can be used for providing alternative resources.

According to that table layout-sw<N>dp has got higher precedence than layout-w<N>dp. So if there is a conflict arises, Android always selects the highest configuration qualifier.

Here both your devices can take resources from layout-sw360dp. So both devices use the same folder for selecting resources.

Upvotes: 1

Related Questions