I am testing the Android application in a small screen mobile. If I use Samsung tablets like other landscape mobile to test my android application the contents are moved slightly. How do I solve the screen resolution in Android?
Asked
Active
Viewed 3,294 times
6
-
I think you should better check it in the Developer's website, where you have all the information. Here it is [Supporting Multiple Screens In Android](http://developer.android.com/guide/practices/screens_support.html) – Lavanya Jan 27 '12 at 05:10
4 Answers
3
use this in manifest.xml
<supports-screens
android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"/>

NagarjunaReddy
- 8,621
- 10
- 63
- 98
1
you can create multiple layouts as per screen size (four different screen size) & put them in different folders under res like below
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
Also you need to add below lines in menifest file
<supports-screens
android:resizeable="true"
android:smallScreens="false"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true"/>
For more information check this link

Sandip Jadhav
- 7,377
- 8
- 44
- 76
0
Try not to hardcode things in terms of px. Try using fill_parent wrap_content. Under very necessary circumstances,create separate folders for your layout as in layout,layout-land,layout-small,layout-small-land,layout-large etc. Place your layout in these folders and change your layout settings. Rest will be taken care by Android OS.

Rashmi.B
- 1,787
- 2
- 18
- 34
-
if i put different layout(large,small.medium) in separate folder.how android will handle these layout.is there any changes in manifest file – Jan 27 '12 at 08:34
-
1add Nagarjuna Reddy's tag in your manifest. Then on changing the orientation or handling different phones, android OS will take care of this itself. – Rashmi.B Jan 27 '12 at 09:37
-1
I think you shuold get the screen resoloution in using java code and then set the widgets size by dynamically in oncreate()
method of activity
by using the given resolution.

Sheraz Ahmad Khilji
- 8,300
- 9
- 52
- 84

mamad
- 1