Issue
I have two layout folders, layout-sw600dp
for 7" Tablet (1024X600) mdpi and another with name layout-xlarge
for 12" Tablet (1280X800) mdpi. The problem is that when I run my project in 7" emulator it pics the layout from layout-xlarge
folder instead of layout-sw600dp
. I have also tried other solutions by changing folder names which are given in different sites but could not find the suitable solution for my problem. Please provide me a working solution for this problem. Thanks in advance.
Solution
The thing to remember here is that using the swXXXdp
resource identifier only works on devices that are running Android 3.2+ (which is when it was added). Older devices will not recognize and therefore will not use these identifiers, so you must use the old identifiers (small
, normal
, large
, xlarge
) if you intend on supporting tablets running Android < 3.2. As of now, only 0.3% of tablets out there run Android 3.1 (API 12), so it's a safe call to not fully support them - http://developer.android.com/about/dashboards/index.html.
There is an excellent blog explaining how to use these newer resource identifiers. http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html
For your particular issue, assuming you are only supporting Android 3.2+ for your tablet layouts, change your layout-xlarge
folder to layout-sw720dp
to support 10"+ tablets, and your layout-sw600dp
will support 7" tablet layouts.
Answered By - Steven Byle
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.