Layout for tablets in Android

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

    According documentation, you should create mutiple asset folders like this..full list......

    res/layout/main_activity.xml  // For handsets (smaller than 600dp available width)
    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)
    res/layout-sw600dp-land/main_activity.xml  // For 7” tablets in landscape (600dp wide and bigger)
    res/layout-sw720dp-land/main_activity.xml  // For 10” tablets in landscape (720dp wide and bigger)
    

提交回复
热议问题