Android supporting multiple resolution with multiple layout folder

前端 未结 4 1233
萌比男神i
萌比男神i 2020-12-01 20:40

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

layout
layout-lar         


        
相关标签:
4条回答
  • 2020-12-01 20:49

    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

    0 讨论(0)
  • 2020-12-01 20:58
    res/drawable – The default image folder
    res/drawable-sw200dp
    res/drawable-sw600dp
    res/drawable-sw800dp
    
    0 讨论(0)
  • 2020-12-01 21:03

    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 讨论(0)
  • 2020-12-01 21:09

    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" />
    
    0 讨论(0)
提交回复
热议问题