Introduction
This article explains how Android applications support multiple screens having various sizes and densities.
Make a simple application having an image and a text. If you now test this application on various devices, you will see that the text and the image appearing on various devices are not the same in terms of their size. In projects/applications where designing is important, multiple screen support is very important.
The Android system itself also provides scaling and resizing to make the Android application support multiple screen sizes and densities, to some extent. Still you should always try to provide such support yourself.
To support multiple screens you should:
1. Set support screens in the Manifest file
2. Provide various layouts for various screen sizes
3. Provide various bitmap drawables for various screen densities
Various screen size variants are: small, normal, large and xlarge.
Various screen density variants are: ldpi for low-density screens, mdpi for medium-density screens, hdpi for high-density screens, xhdpi for extra high-density screens and nodpi for all densities. tvdpi screens are somewhere between mdpi and hdpi; approximately 213dpi.
Step 1
Open "AndroidManifest" and add the following code to it:
- <?xml version="1.0" encoding="utf-8"?>
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.chhavi.supportmultiplescreens"
- android:versionCode="1"
- android:versionName="1.0" >
- <supports-screens android:smallScreens="true"
- android:normalScreens="true"
- android:largeScreens="true"
- android:xlargeScreens="true"
- android:anyDensity="true"
- android:resizeable="true"/>
- <uses-sdk
- android:minSdkVersion="7"
- android:targetSdkVersion="16" />
- <application
- android:allowBackup="true"
- android:icon="@drawable/ic_launcher"
- android:label="@string/app_name"
- android:theme="@style/AppTheme" >
- <activity
- android:name="com.chhavi.supportmultiplescreens.MainActivity"
- android:label="@string/app_name" >
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
- </manifest>
Step 2
Go to "res" -> "values" -> "dimens.xml". Apply the following changes to it:
- <resources>
- <!-- Default screen margins, per the Android Design guidelines. -->
- <dimen name="activity_horizontal_margin">16dp</dimen>
- <dimen name="activity_vertical_margin">16dp</dimen>
- <dimen name="txt">30dp</dimen>
- </resources>
Step 3






Marcel EglsederPosted Apr 8, 2018, 1:07 PM
Can you send me the code with an email?
Rajnish VishwakarmaPosted Dec 5, 2015, 2:45 AM
Nice artcle .but there is one query as on google developers site it is suggested that the baseleine is mdpi as in the above example the image for the drawable-mdpi is 500*500 so for ldpi its should be 375*375 and for 750 in drawable-hdpi .so i m confused ..please clarify .waiting for ur replyy..
Mrugesh PatelPosted Jul 24, 2014, 2:29 PM
Nice article, It's help me lot to learn about multiple device with same screen. But i have one question... How to make reach graphical application in android? Is there any tool? Can you help me?
RanoPosted Jul 15, 2013, 6:15 AM
Nice article. I want to know if we need each layout with landscape folder like normal-land , small-land etc.