2

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?

1
  • guys I know that way. I just want to know how to set exact resolution for xml. In my case, 800x480 xml is working on 1280x720 resolution. That's the problem.
    – Fukkong
    Dec 24, 2013 at 19:25

4 Answers 4

7

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" />
2
  • It's just 'How to set layout folder name' :p
    – Fukkong
    Dec 24, 2013 at 19:28
  • so thats have the solution of perticular device layout. just create the values for the resolution 480x800 and the values-sw720dp for the resolution 1280x720 and not need the different layout resolution folder to be create just simply create the layout. its work well. Dec 25, 2013 at 5:07
1

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

1
  • This is just another way to support various resolution. I want to set xml in exact resolution.
    – Fukkong
    Dec 24, 2013 at 19:26
1

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)
0
res/drawable – The default image folder
res/drawable-sw200dp
res/drawable-sw600dp
res/drawable-sw800dp

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.