android – 所有屏幕设备的图像大小

android – 所有屏幕设备的图像大小,第1张

概述我有PSD,分辨率是1080X1920,它包含一个分辨率为22X22的Dot图像. 我已裁剪该图像并将其放入我的res文件夹中. 我的问题是Android如何知道该图像适用于1080X1920屏幕.它会在小屏幕上打开相同的图像,在2560×1440分辨率下打开更小的图像. 有没有办法,除了为每个屏幕尺寸放置不同的图像,告诉Android使用图像的特定屏幕尺寸和其他屏幕的比例 直接使用 https: 我有PSD,分辨率是1080X1920,它包含一个分辨率为22X22的Dot图像.

我已裁剪该图像并将其放入我的res文件夹中.

我的问题是Android如何知道该图像适用于1080X1920屏幕.它会在小屏幕上打开相同的图像,在2560×1440分辨率下打开更小的图像.

有没有办法,除了为每个屏幕尺寸放置不同的图像,告诉AndroID使用图像的特定屏幕尺寸和其他屏幕的比例

解决方法 直接使用 https://romannurik.github.io/AndroidAssetStudio/

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

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

屏幕密度的变化.

xlarge screens are at least 960dp x 720dplarge screens are at least 640dp x 480dpnormal screens are at least 470dp x 320dpsmall screens are at least 426dp x 320dp

制作此布局文件,以使其对所有设备都相同.

根据设备提供填充,边距,字体和所有属性.

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 sizeres/layout-xlarge/my_layout.xml       // layout for extra-large screen sizeres/layout-xlarge-land/my_layout.xml  // layout for extra-large in landscape orIEntation

对于图像

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

对于图标

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

对于Launcher图标

36x36 (0.75x) for low-density48x48 (1.0x baseline) for medium-density72x72 (1.5x) for high-density96x96 (2.0x) for extra-high-density180x180 (3.0x) for extra-extra-high-density192x192 (4.0x) for extra-extra-extra-high-density (launcher icon only; see note above)

结帐Dimension和
Supporting Multiple Screens官方文件.

总结

以上是内存溢出为你收集整理的android – 所有屏幕设备的图像大小全部内容,希望文章能够帮你解决android – 所有屏幕设备的图像大小所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1136523.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存