user3251646
user3251646

Reputation: 278

How to enable layouts for multiple(different sizes of) screen in ANDROID?

I'm new to android
I want to run the android application in different screen sizes
Created

res/layout/layout.xml         
/res/layout-small/layout.xml   
/res/layout-large/layout.xml   
/res/layout-xlarge/layout.xml

four types of layout in my application
After this what I want to do
Can any one say with example .Is there any other change want to make it in code
Thanks in advance

Upvotes: 0

Views: 117

Answers (2)

user1831682
user1831682

Reputation:

use following ,

for small screen

res/layout/layout.xml         
/res/layout-land/layout.xml 

for large screen like tablets you can use,,

/res/layout-large-hdpi/layout.xml   
/res/layout-land-large-hdpi/layout.xml

these two representations are enough and it can fit to all devices

layout-land is for landscape mode for smaller devices and layout-land-large-hdpi for large devices,

and add these lines to your manifest.xml

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

Upvotes: 2

user3251646
user3251646

Reputation: 278

Add This code in XML file before compiling the app
    <supports-screens android:anyDensity="true" 
    android:largeScreens="true" 
    android:normalScreens="true"
    android:smallScreens="true" 
    android:xlargeScreens="true" />

Upvotes: 2

Related Questions