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 from layout-600dp
but will take layout from
layout-320dp
3) inside layout-600dp
folder--> put activity_main_tab.xml with layout according
to tablet 7'' Screen
4) 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.