Fukkong
Fukkong

Reputation: 863

Android supporting multiple resolution with multiple layout folder

Now I'm supporting multiple resolution with multiple layout folders. I'm using android development studio and I made 3 different folders.

layout
layout-large-port-1280x720
layout-normal-port-800x480 

and I tested on 800x480 and 1280x720. 480x800 worked well, but 1280x720 follow 800x480 folder's dp and UI.

I don't know why this thing happens to me and I don't know how to solve the problem. Why it doesn't work and what should I have to do?

Upvotes: 2

Views: 14676

Answers (4)

Brave
Brave

Reputation: 367

U should use:

res/layout/main_activity.xml           # For handsets (smaller than 480dp available width)
res/layout-sw480dp/main_activity.xml   # For phones (480dp wide and bigger)
res/layout-sw600dp/main_activity.xml   # For 7” tablets (600dp wide and bigger)
res/layout-sw720dp/main_activity.xml   # For 10” tablets (720dp wide and bigger)

Upvotes: 1

patel135
patel135

Reputation: 927

res/drawable – The default image folder
res/drawable-sw200dp
res/drawable-sw600dp
res/drawable-sw800dp

Upvotes: 0

Gorgeous_DroidVirus
Gorgeous_DroidVirus

Reputation: 320

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

Thats code in the Manifest supports all dpis.

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

Upvotes: 7

Akbarsha
Akbarsha

Reputation: 2568

make sure you have given the corresponding drawables in drawable-xhdpi

I don't know on what basis you're creating the App. But it's better to avoid creating layout for specific screen sizes.. Instead you would give the following:

layout-small-port for devices like samsung galaxy y

layout-normal-port for devices like galaxy s2

layout-large-port for devices like nexus 7 which is 7 inch

layout-xlarge-port for devices having more than 7 inch size

If you specify the screen size, you can't support more number of devices

Upvotes: 1

Related Questions