Android: Support Multiple Screens

multiple screen support in android

http://developer.android.com/guide/practices/screens_support.html

You have to add different folder for different layout in res folder --> hdpi,mdpi,ldpi and for large screens you xhdpi(for Tablet) and large-hdpi or xlarge (for NXzoom). Also set Images and text size different in different layout as per screensize...

Supporting Multiple Screens - usage of compatible-screens

After looking into this for two days (shame on me for taking this long), I looked into the AVD manager in Android Studio to find out that the Nexus 7, which has the same specs as my Acer Iconia, is considered Large, not Normal.
Once I changed the

<screen   android:screenSize="normal"  android:screenDensity="213"/>

to:

<screen   android:screenSize="large"  android:screenDensity="213"/>

and uploaded the new APK to the Play Store, my tablet was finally compatible with the app. I hope this helps somebody someday when they cant figure out why their tvdpi tablet is deemed not compatible with their app.

Supporting multiple screens in android

you dont choose from which folder you read the xmls. Android does it for you depending on the dpi and the size of the screen its running on.

This is what helped me:
http://android-developers.blogspot.in/2011/07/new-tools-for-managing-screen-sizes.html

How to support different screen size in android

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.

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

res/drawable-mdpi/my_icon.png // bitmap for medium density
res/drawable-hdpi/my_icon.png // bitmap for high density
res/drawable-xhdpi/my_icon.png // bitmap for extra high density

The following code in the Manifest supports all dpis.

<supports-screens android:smallScreens="true" 
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />

And also check out my SO answer.

Supporting multiple screen size - Android

I just did something very similar. To stretch the app without creating new layouts I used dimensions set in XML

res/values/dimensions.xml
res/values-sw600dp/dimensions.xml -> 7+ inches
res/values-sw720dp/dimensions.xml -> 10+ inches

Dimensions are resources files:

<dimen name="default_padding">11dp</dimen>

You can increase the dimensions by about 30% in the 600 and 720 file.
Then simply used @dimen/default_padding in your layout and it will be scaled

Regarding images, either you make sure you have all your assets in all densities, or you set fixed size to you ImageView's and appropriate scaleType



Related Topics



Leave a reply



Submit