gpt4 book ai didi

android - 屏幕密度和图像尺寸

转载 作者:搜寻专家 更新时间:2023-11-01 09:34:31 24 4
gpt4 key购买 nike

嗨,Android 开发者,

我想知道如何选择可绘制对象的尺寸;例如,我有一张我想插入到我的应用程序中的图像,图像应该插入到 xxhdpi、xhdpi、hdpi、mdpi 和 ldpi 中的尺寸(像素)是多少?

我在 GitHub 上分析了很多 Android 应用程序,它们使用随机图像大小(像素)来处理不同的密度。

最佳答案

To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six generalized densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:

  • 36x36 (0.75x) for low-density
  • 48x48 (1.0x baseline) for medium-density
  • 72x72 (1.5x) for high-density
  • 96x96 (2.0x) for extra-high-density
  • 144x144 (3.0x) for extra-extra-high-density
  • 192x192 (4.0x) for extra-extra-extra-high-density

来源:https://developer.android.com/guide/practices/screens_support.html#DesigningResources

关于android - 屏幕密度和图像尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44489892/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com