The requirement for the app is that it should work on all devices. To support this I have
following layout defs-
layout/
layout-land/
layout-sw400dp-port/
layout-sw400dp-land/
layout-sw600dp-port/
layout-sw600dp-land/
layout-sw7200dp-port/
layout-sw7200dp-land/
its working fine for 7" and 10" tablets.
for the sw400dp
devices ie 5" devices like Samsung Note etc, they are using layout/
and
layout-land/
. How can I force these devices to use
layout-sw400dp-port/
and layout-sw400dp-land/
You can't
The original Note runs GingerBread (2.3) and the sw-
identifiers only work from 3.2 upwards.
http://developer.android.com/guide/practices/screens_support.html#support
The configuration qualifiers you can use to provide size-specific resources are small, normal, large, and xlarge. For example, layouts for an extra large screen should go in layout-xlarge/.
Beginning with Android 3.2 (API level 13), the above size groups are deprecated and you should instead use the swdp configuration qualifier
Devices < 3.2 will not use the -sw
layouts. To support all API levels you will need to provide layouts using both types of qualifiers.
Check out this post: http://android-developers.blogspot.co.uk/2011/07/new-tools-for-managing-screen-sizes.html
Previous versions of the platform will ignore any resources using the new resource qualifiers. This, then, is one approach that will work:
res/layout/main_activity.xml # For phones
res/layout-xlarge/main_activity.xml # For pre-3.2 tablets
res/layout-sw600dp/main_activity.xml # For 3.2 and up tablets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With