屏幕密度和图像尺寸 [英] Screen densities and images dimensions

查看:94
本文介绍了屏幕密度和图像尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好 Android 开发者:

Hi Android developers,

我想知道如何选择drawables的尺寸;例如,我想在我的应用程序中插入一个图像,该图像应该插入到 xxhdpi、xhdpi、hdpi、mdpi 和 ldpi 中的大小(像素)?

I want to know how to choose the dimensions of drawables; for example, I have an image that I want to insert in my app, what size (pixel) the image should be to be inserted inside xxhdpi, xhdpi, hdpi, mdpi, and ldpi ?

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

I've analyzed many android apps on GitHub, they use random image sizes (pixel) for different densities.

推荐答案

要为不同密度创建替代位图可绘制对象,您应该遵循六种广义密度之间的 3:4:6:8:12:16 缩放比例.例如,如果您有一个用于中等密度屏幕的 48x48 像素的位图可绘制对象,则所有不同的尺寸应该是:

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) 用于低密度
  • 48x48(1.0x 基线),适用于中等密度
  • 72x72 (1.5x) 用于高密度
  • 96x96 (2.0x) 用于超高密度
  • 144x144 (3.0x) 用于超高密度
  • 192x192 (4.0x) 用于超高密度

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

这篇关于屏幕密度和图像尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆