I have a problem which I`m unable to solve lately..
I have make a simple app for tablet which I run in my Samsung Galaxy Note 8.0 .. I have set the layout to place some text view at some place.. I code it in xml using dp for margin and sp for text size. The width and height layout is set to wrapcontent. But when I run it in my friend Samsung Galaxy Tab 2 7.0, the layout did not match what I see in my device. The same thing happen when I try to run it in 10inch emulator.
I have use layout-sw600dp for my layout folder..
Why my screen layout is like that?I though by using layout-sw600dp the layout supposedly to adjust itself.. Or am I wrong regarding that?
I have read android documentation regarding different screensize support and so far I found using layout-sw600dp is good solution..
I have checked the device dpi using :
Display display = getWindowManager().getDefaultDisplay();
DisplayMetrics outMetrics = new DisplayMetrics ();
display.getMetrics(outMetrics);
float density = getResources().getDisplayMetrics().density;
float dpHeight = outMetrics.heightPixels / density;
float dpWidth = outMetrics.widthPixels / density;
Every device has different pixel ratio, different dpi, different screen size and so on. Go to this link, read it, you will know how to manage different device layouts.