I have two 7 inch tablet one tablet (800*480) and second tablet (1024*600). I have facing problem following :-
1. Both can run on layout-mdpi and layout-lar
Try using this.It worked for me
layout-sw600dp
I have two 7 inch tablet one tablet (800*480) and second tablet (1024*600). I have facing problem following :-
I have faced the Same issue. as a workaround i have make the xml file for (800*480) in same layout folder as Default.
Also used layout-sw320dp for the Devices like GalaxyNexus and for 7'' Tablet i have make layout-sw600dp for 7'' Screen Tablet and for 10'' Tablet i have make layout-sw700dp for 10'' Screen Tablet
For Example : you have the xml file named "activity_main.xml"
1) inside
layout
folder--> put activity_main.xml with layout according to nexus one(480*800 hdpi)2) inside
layout-sw320dp
folder--> put activity_main_tab.xml with Layout according to Galaxy Nexus(720*1280 xhdpi) Device which should take the layout fromlayout-600dp
but will take layout fromlayout-320dp
3) inside
layout-600dp
folder--> put activity_main_tab.xml with layout according to tablet 7'' Screen4) inside
layout-700dp
folder--> put activity_main_tab.xml with layout according to tablet 10'' Screen
after making the Layout formated as above. i have checked runtime width and height of device. and set the layout file accordingly.
if (displayWidth >= 552 && displayHeight >= 976 || displayWidth >= 976
&& displayHeight >= 552) {
Log.i(TAG, "in tab xml");
setContentView(R.layout.activity_main_tab);
}else{
Log.i(TAG, "in Simple xml");
setContentView(R.layout.activity_main);
}
Hope this will Help.
7" tablets—Android 3.2 introduces a new way to specify resources for more discrete screen sizes. The new technique is based on the amount of space your layout needs (such as 600dp of width), rather than trying to make your layout fit the generalized size groups (such as large or xlarge).
res/layout-sw600dp/
res/layout-sw600dp-land
res/layout-sw600dp-port
UI to differentiate between sizes such as 7” and 10” tablets
xlarge is a configuration qualifier for extra large screens.* When you append this string to a resource directory name (such as layout-xlarge), it indicates to the system that these resources are to be used on devices that have an extra large screen.