0

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 ?

tony9099
  • 4,567
  • 9
  • 44
  • 73
  • what's your question? – Budius Apr 02 '13 at 13:29
  • @Budius my post is edited. please have a look. – tony9099 Apr 02 '13 at 13:35
  • @CoreyScott can you be more specific please ? – tony9099 Apr 02 '13 at 13:37
  • @CoreyScott there is something which does not make sense in the second answer also. It is suggested to use layout-sw720dp (which I did and in the presence of layout-sw360dp folder, it was still unread, and even though layout-sw720dp would not work as S3 is xhdpi device.) Do you have any suggestions/hints/solutions ? I need to make Sensation and S3 on different layouts. – tony9099 Apr 02 '13 at 13:44
  • Edit: removed "chat" comments and copied last comment from answer #2, seems i was wrong, its working as intended. "The Galaxy S3 is a xhdpi device, so you have to divide a pixel-based dimension by 2 to get the dimension in dp. So the S3 is 640dp tall, and 360dp wide. – navale Oct 19 '12 at 7:57" – Corey Scott Apr 02 '13 at 13:53
  • @CoreyScott how does this help me ? Are you getting my question ? – tony9099 Apr 02 '13 at 13:56

1 Answers1

1

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.

Renjith
  • 5,783
  • 9
  • 31
  • 42