Layout for tablets in Android

后端 未结 6 1257
生来不讨喜
生来不讨喜 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:36

    I know this is an old question, but for the sake of it... According documentation, you should create mutiple asset folders like this

    res/layout/main_activity.xml           # For handsets (smaller than 600dp available width)
    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)
    

提交回复
热议问题