Layout for tablets in Android

后端 未结 6 1268
生来不讨喜
生来不讨喜 2020-11-28 20:15

I would like to create different layouts for tablets and handsets in Android. Where should I put the layout resources in order to make this differentiation?

6条回答
  •  生来不讨喜
    2020-11-28 20:27

    With layouts, I believe you can only current differentiate by the following:

    res/layout/my_layout.xml            // layout for normal screen size
    res/layout-small/my_layout.xml      // layout for small screen size
    res/layout-large/my_layout.xml      // layout for large screen size
    res/layout-large-land/my_layout.xml // layout for large screen size in landscape mode
    

    You can find more info on what you can add to the folder structure to differentiate between different settings here.

    The biggest problem is that the Android SDK hasn't really incorporated tablets officially. Hopefully that will be resolved in the next version of Android. Otherwise, you just need to make sure you use scaling layouts that will work for any screen size.

提交回复
热议问题