【问题标题】:Android Images for a page layout用于页面布局的 Android 图像
【发布时间】:2013-09-17 10:17:41
【问题描述】:

我正在开发一个可以在多个设备上运行的 android 应用程序。

我目前在布局中使用 2 张图片,但遇到了问题。 Nexus 7 和 Nexus S 都属于 HDPI 布局,它们加载相同的图像。其中一张图片用于创建我的应用程序的“页脚”,它被设计为适合 Nexus S 尺寸(480 像素),所以它在我的 N7 中被拉伸,导致一些丑陋的东西。

有什么办法可以解决这个问题吗?

【问题讨论】:

    标签: android image layout hdpi


    【解决方案1】:
    Low density Small screens QVGA 240x320 (120dpi):
    
    layout-small-ldpi (240x320)  
    layout-small-land-ldpi (320x240)
    
    Low density Normal screens WVGA400 240x400 (x432) (120dpi):
    
    layout-ldpi  (240 x 400 )
    layout-land-ldpi  (400 x 240 )
    
    Medium density Normal screens HVGA 320x480 (160dpi):
    
    layout-mdpi (320 x 480 )
    layout-land-mdpi (480 x 320 )
    
    Medium density Large screens HVGA 320x480 (160dpi):
    
    layout-large-mdpi (320 x 480 )
    layout-large-land-mdpi (480 x 320)
    
    Galaxy Tab ( 240 dpi ):
    
    layout-large  (600 x 1024) 
    layout-large-land  (1024 x 600)
    
    High density Normal screens WVGA800 480x800 (x854) (240 dpi):
    
    layout-hdpi (480 x 800)
    layout-land-hdpi (800 x 480)
    
    Xoom (medium density large but 1280x800 res) (160 dpi):
    
    layout-xlarge (800 x 1280)
    layout-xlarge-land (1280 x 800)
    

    【讨论】:

      【解决方案2】:

      尝试根据屏幕大小使用drawable 文件夹,例如。

      1. drawable-large
      2. drawable-small
      3. drawable-normal
      

      或者根据宽度例如。

      1. drawable-sw360dp
      2. drawable-sw480dp
      

      【讨论】:

      • 自 Android 3.2 以来不是已弃用吗?
      • 是的,以前的限定符已被弃用,因此您可以使用 drawable-sw360dp-mdpidrawable-sw480dp-hdpi 代替 drawable-largedrawable-normal
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-21
      • 1970-01-01
      • 2011-06-30
      • 2012-02-12
      • 1970-01-01
      • 2018-10-11
      • 1970-01-01
      相关资源
      最近更新 更多