所有屏幕设备的图像大小 [英] Image size for all screen devices

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

问题描述

我有 PSD ,分辨率是 1080X1920 ,它包含 Dot 分辨率为 22X22 的图片。

I have PSD, resolution of that is 1080X1920, it contains a Dot image whose resolution is 22X22.

我裁剪了那张图片并将其放入我的图片中 res 文件夹。

I have cropped that image and put it in my res folder.

我的问题是Android如何知道该图片适用于 1080X1920 屏幕。它将在屏幕中打开相同的图像,在 2560x1440 分辨率下打开更小。

My question is how would Android know that the image is for 1080X1920 screen. It would open the same image bigger in small screen and smaller in 2560x1440 resolution.

除了为每个屏幕尺寸添加不同的图像之外,还有其他方法可以告诉Android使用该图像获取特定屏幕尺寸并缩放其他屏幕

Is there a way other than putting different images for each screen sizes to tell android to use the image for specific screen size and scale for other screens

推荐答案

直接使用 https://romannurik.github.io/AndroidAssetStudio/


例如,两台设备两者都报告正常
的屏幕尺寸可能有实际的屏幕尺寸和宽高比,当手动测量时,它们的价格略有
。同样,报告hbpi屏幕密度为
的两台设备的实际像素密度可能与
略有不同。 Android将这些差异抽象为
应用程序,因此您可以提供针对广义尺寸
和密度设计的UI,并让系统处理任何最终调整为
必要

For example, two devices that both report a screen size of normal might have actual screen sizes and aspect ratios that are slightly different when measured by hand. Similarly, two devices that report a screen density of hdpi might have real pixel densities that are slightly different. Android makes these differences abstract to applications, so you can provide UI designed for the generalized sizes and densities and let the system handle any final adjustments as necessary

您必须创建不同的维度,布局,图像和图标文件以支持所有设备。

You have to create different dimen , layout , images and icon files to support all devices.

屏幕密度的变化。

xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp

制作此布局文件,以便所有设备都相同

提供填充,边距,字体以及每个设备的所有属性。

Give padding ,margin ,font and all properties as per devices.

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)

布局

res/layout/my_layout.xml              // layout for normal screen size ("default")
res/layout-large/my_layout.xml        // layout for large screen size
res/layout-xlarge/my_layout.xml       // layout for extra-large screen size
res/layout-xlarge-land/my_layout.xml  // layout for extra-large in landscape orientation






图片

res/drawable-mdpi/graphic.png         // bitmap for medium-density
res/drawable-hdpi/graphic.png         // bitmap for high-density
res/drawable-xhdpi/graphic.png        // bitmap for extra-high-density
res/drawable-xxhdpi/graphic.png       // bitmap for extra-extra-high-density






图标

res/mipmap-mdpi/my_icon.png         // launcher icon for medium-density
res/mipmap-hdpi/my_icon.png         // launcher icon for high-density
res/mipmap-xhdpi/my_icon.png        // launcher icon for extra-high-density
res/mipmap-xxhdpi/my_icon.png       // launcher icon for extra-extra-high-density
res/mipmap-xxxhdpi/my_icon.png      // launcher icon for extra-extra-extra-high-density

用于启动器图标

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
180x180 (3.0x) for extra-extra-high-density
192x192 (4.0x) for extra-extra-extra-high-density (launcher icon only; see note above)

结帐维度
支持多个屏幕官方文档。

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

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