【问题标题】:Android standard for image assets图像资源的 Android 标准
【发布时间】:2017-05-07 15:21:13
【问题描述】:

我是一名 iOS 开发人员,是 Android 开发的新手。我需要将图像资产要求发送给设计师。但我不确定在 android 应用程序中使用的图像大小的标准。在 iOS 中,资产的大小必须为 1x、2x 和 3x 大小。同样,Android 会是什么?我在项目的抽屉文件夹中看到了一些文件夹,例如“ldpi、mdpi、hdpi、xhdpi、xxhdpi 和 xxxhdpi”。每个文件夹代表什么。我需要告诉背景、应用程序图标、按钮图标等图像的大小。

【问题讨论】:

  • 它通常遵循 3:4:6:8 的比例(如 ldpi : mdpi : hdpi : xhdpi ),假设你的基本图标大小是 12 根据你的屏幕设计,你可以让它不同该图标的大小如 12X3 = 36 (36x36) ,12x4 = 48 (48x48) ,12x6 = 72 (72x72) ,12x8 = 96 (96x96) 。这里您的基本图标大小可以根据设计而有所不同,它不固定为 i提到 (ex:12) ,你只需要按照纵横比计算。
  • @sree_iphonedev 你没收到吗??
  • Radheys 的评论非常清楚。谢谢。
  • xxhdpi 和 xxxhdpi 的尺寸如何?

标签: android image android-studio android-resources


【解决方案1】:

答案可以在android dev官方网站上找到,也可以在上面的答案中找到。由于没有给出确切的答案,我附上一张应该可以解决所有困惑的图片。

This image shows the respective DPI's

为了进一步完善答案,

ldpi:用于低密度 (ldpi) 屏幕 (~120dpi) 的资源。

mdpi:用于中等密度 (mdpi) 屏幕 (~160dpi) 的资源。 (这是基线密度。)

hdpi:用于高密度 (hdpi) 屏幕 (~240dpi) 的资源。

xhdpi:超高密度 (xhdpi) 屏幕 (~320dpi) 的资源。

xxhdpi:超超高密度 (xxhdpi) 屏幕 (~480dpi) 的资源。

xxxhdpi:超超超高密度 (xxxhdpi) 用途的资源 (~640dpi)。

https://developer.android.com/training/multiscreen/screendensities

【讨论】:

    【解决方案2】:

    在 iOS 中,我们可以为图像创建资产,例如 1x2x3x。如果我们寻找1x2x3x 的大小。就像40 x 4080 x 80120 x 120这样的格式。

    所以在 iOS 中

    1x : 40 x 40

    2x : 80 x 80

    3x : 120 x 120

    在安卓中

    ldpi:36 x 36

    mdpi:48 x 48

    hdpi:72 x 72

    xhdpi : 96 x 96

    xxhdpi : 144 x 144

    希望这会对你有所帮助。

    【讨论】:

    • 例如:- 我有一个 50 dp x 50 dp 的图像。所以ldpi应该是50,对吧?在这种情况下,其他人的尺寸是多少?
    【解决方案3】:
     //and android resolution is
        layout-large-mdpi   (1024x600)
        layout-large-tvdpi  (800x1280)
        layout-large-xhdpi  (1200x1920)
        layout-xlarge-mdpi  (1280x800)
        layout-xlarge-xhdpi (2560x1600)       
    
    
    //There is a different devices in android like this (for images icon)
                drawable-mdpi (48X48)
                drawable-hdpi (72X72)
                drawable-xhdpi (96X96)
                drawable-xxhdpi (144X144)
                drawable-xxxhdpi (192X192)
    

    您已放入所有分辨率的图像,系统会自动获取特定分辨率的移动设备以获取更多信息,请参阅此链接: Different resolution support android

    【讨论】:

      【解决方案4】:

      Android 中的广义密度是

      ldpi (low) ~120dpi
      mdpi (medium) ~160dpi
      hdpi (high) ~240dpi
      xhdpi (extra-high) ~320dpi
      xxhdpi (extra-extra-high) ~480dpi
      xxxhdpi (extra-extra-extra-high) ~640dpi
      
      1DPI (dot per inch) ~= 0.393701Pixels
      

      【讨论】:

        猜你喜欢
        • 2011-11-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-09-14
        • 2012-04-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多