【问题标题】:Managing layout for all devices管理所有设备的布局
【发布时间】:2012-03-16 10:11:12
【问题描述】:

其实我是安卓新手。我想创建一个能够在所有设备上运行的简单应用程序。我为运行我的应用程序选择的屏幕分辨率是。

  1. QVGA (240 x 320)

  2. HVGA (320 x 480)

  3. WVGA(800) (480 x 800)

  4. WXGA720 (720 x 1280)

  5. WXGA(800) (1280 x 800)

现在我无法确定所有这些不同分辨率的资源文件夹的名称。我通过了文档,即支持多屏幕,但我无法为 WXGA720 (720 x 1280) 和 WXGA(800) (1280 x 800) 创建资源文件夹。

所以请任何人建议我为所有这些分辨率创建的资源文件夹是什么。

【问题讨论】:

    标签: android


    【解决方案1】:
    To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:
    
        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).
    
    For other cases in which you want to further customize your UI to differentiate between sizes such as 7” and 10” tablets, you can define additional smallest width layouts:
    
        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)
    

    【讨论】:

      【解决方案2】:

      请记住始终以 dp 单位定义布局测量。我写了一篇博文来帮助您按比例缩放布局 xml 文件,因此您只需为单个“密度桶”定义它们。

      http://onemanmobile.blogspot.com/2012/04/how-to-scale-your-android-layouts-to.html

      【讨论】:

        【解决方案3】:

        您通常为各种密度和大小的存储桶创建资源文件夹,而不是为特定分辨率创建资源文件夹。通常应用程序只需要几个不同的布局(例如:手机/平板电脑)

        【讨论】:

        • 你能详细解释一下吗\
        • 您要开发什么样的应用程序?游戏/高度图形化的游戏还是“普通”游戏?您通常所做的是指定布局以使其自动适应用户的手机
        猜你喜欢
        • 1970-01-01
        • 2023-03-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-05-02
        • 2015-08-08
        相关资源
        最近更新 更多