How to set layout on 7" two different tablet?

后端 未结 3 1633
迷失自我
迷失自我 2021-01-01 05:16

I have two 7 inch tablet one tablet (800*480) and second tablet (1024*600). I have facing problem following :-

1. Both can run on layout-mdpi and layout-lar

3条回答
  •  天涯浪人
    2021-01-01 06:01

    7" tablets—Android 3.2 introduces a new way to specify resources for more discrete screen sizes. The new technique is based on the amount of space your layout needs (such as 600dp of width), rather than trying to make your layout fit the generalized size groups (such as large or xlarge).

    res/layout-sw600dp/
    res/layout-sw600dp-land
    res/layout-sw600dp-port
    
    • 320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
    • 480dp: a tweener tablet like the Streak (480x800 mdpi).
    • 600dp: a 7” tablet (600x1024 mdpi).
    • 720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).

    UI to differentiate between sizes such as 7” and 10” tablets

    1. res/layout/main_activity.xml # For handsets (smaller than 600dp available width)
    2. res/layout-sw600dp/main_activity.xml # For 7” tablets (600dp wide and bigger)
    3. res/layout-sw720dp/main_activity.xml # For 10” tablets (720dp wide and bigger)

    xlarge is a configuration qualifier for extra large screens.* When you append this string to a resource directory name (such as layout-xlarge), it indicates to the system that these resources are to be used on devices that have an extra large screen.

提交回复
热议问题