简体   繁体   中英

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

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" />
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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM