My Xml design not working in all android Devices?

前端 未结 3 1949
眼角桃花
眼角桃花 2020-12-14 13:46

In my project, My Design is working fine in my android HTC 2.3.4 But on 4.0.1 my screen is not showing full ( Some design is cutting from Bottom). Why?

3条回答
  •  北海茫月
    2020-12-14 14:06

    One layout doesn't always work for all the various screen sizes. Since android has at least 4 different screen sizes (small, medium, large, extra large) You will either need to use dp (density pixels) in a smart way, or have a different layout for each screen resolution (which i personally reccomend)

    The way you do this is create folder for each type of layout you want, as shown below. Quote from http://developer.android.com/guide/practices/screens_support.html : For example, 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 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

    you can also just use

    in your manifest in order to choose which screen sizes you want it available on. But then people won't be able to download it from the store at all if they have a different size screen

提交回复
热议问题