I know this questions has been asked quite a few times. But I couldn't find the bebest possible solution to my query.
I have followed every step given in the developer support of android.
Support Multiple Screen
Putting images in different folders for different sizes. Making different layout folders for device screens. But the problem persist in the devices ranging from 4.7 inches to 5.0 inches. The layout gets quite disturbed on these devices.
What is the best and possible way to overcome that.
Basically some devices belongs to large or normal group but they have so much difference in height and width for example-
Nexus-4 4.7"
having dimensions768x1280
and one other device5.1"
having dimensions480x800
. So you can create layouts folders depending upon height and width. For example-layout-w480dp, layout-w720dp or layout-h800dp or layout-h1280dp
. Then set views in those layouts according to your requirement.If you need an absolute measure of your the screen's density you can use the following code:
Got this from somewhere sometime ago, but still relevant. Enjoy it !
The value metrics.density now contains a measure of the screen's density with 160dpi density as a the 'baseline'. More info can be found here:
http://developer.android.com/reference/android/util/DisplayMetrics.html#density
If you are designing any forms go for Match Parent, dont go for hardcore pixel positions. Use Relative layout.
P.S Please tell more about your compatibility issues?
Please refer these link:
Multipal screen size handling!
For Different screen size, The following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for small, medium, high, and extra high density screens.
The following code in the Manifest supports all dpis.
Please refer below link:
For Different screen size, The following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for small, medium, high, and extra high density screens. you could use different size of the layout files in res folder and also vary for drawable images based on the density..
And followed by any activity use this lines..