Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 964
Fukkong Avatar asked Jun 04 '26 14:06

Fukkong


2 Answers

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" />
like image 63
Gorgeous_DroidVirus Avatar answered Jun 07 '26 22:06

Gorgeous_DroidVirus


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

like image 37
Akbarsha Avatar answered Jun 08 '26 00:06

Akbarsha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!