How to support different screen size in android

前端 未结 9 808
天涯浪人
天涯浪人 2020-11-22 05:29

I\'m developing an app in android and I have to support all different screen sizes and density. So i\'ve created different folder for layout : layout-small layout-larg

9条回答
  •  一生所求
    2020-11-22 05:59

    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
    

    The following code in the Manifest supports all dpis.

    
    

    And also check out my SO answer.

提交回复
热议问题