根据屏幕尺寸调整你的形象? [英] Resize your image according to screen sizes?

查看:209
本文介绍了根据屏幕尺寸调整你的形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,每当我测试了我的Droid X和Droid的仿生,图像在这里居然罚款我的应用程序。但每当我在较大的设备,如Android平板电脑进行了测试。图像有点捉襟见肘。

I noticed that whenever I tested my app on my Droid X and Droid Bionic, the images where actually fine. But whenever I tested it on Larger devices such as Android Tablet. The image is kinda stretched.

我也有一个关于下面的信息的问题,我试图让4份my_layout.xml,并将其保存在布局,布局小,布局XLARGE,布局XLARGE陆的文件夹。他们每个人都包含不同大小的图像。这人做了工作,他们都看在屏幕设备中的任何大小不错。但我的问题是,我有300个以上的版面配置包含相同的图​​像,这是否意味着我必须为他们创造的每一个副本,并修改图片大小?有没有解决这个其他方式?

I also have a question about the information below, I tried to make 4 copies of "my_layout.xml" and store it in "layout,layout-small,layout-xlarge,layout-xlarge-land" folders. Each of them contain different sizes of the image. That one did the work, they all look good in any sizes of screen devices. But my problem is, I have 300 or more layouts that contain the same image, does it mean I have to create a copy for each one of them and modify the image size? Is there any other way to solve this?

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
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

我也试图让不同大小的图像,并将其存储在绘制,华电国际,绘制,LDPI,绘制,MDPI他们都期待罚款所有的屏幕设备除了在5.1 WVGA,FWVGA 5.4in和10.1 WXGA

I also tried to make different sizes of the image and store it in "drawable-hdpi,drawable-ldpi,drawable-mdpi" They all look fine in all screen devices except in "5.1 WVGA, 5.4in FWVGA, and 10.1 WXGA"

就像我之前说的,做不同的布局不同尺寸的解决这个问题,但我真的要为他们创造的每一个副本,并修改图片大小?有没有解决这个其他方式?

Like I said before, making different layouts with different sizes solve the problem, but do I really have to create a copy for each one of them and modify the image size? Is there any other way to solve this?

推荐答案

您不必手动与放重的大小;加入绘制,华电国际,绘制,LDPI,绘制,MDPI这会增加你的APK的大小,而不是只用一个高分辨率图像,并把它放在绘制-nodpi或只是绘制或绘制,华电国际。在所有的设备进行测试。它应该工作的罚款。  提示:把那会好看的10.1英寸WXGA图像,自动,下屏幕尺寸会好看

You need not re-size manually & add in "drawable-hdpi,drawable-ldpi,drawable-mdpi" This will increase your APK's size, instead use only one High Resolution image and put it in "drawable-nodpi" or just in "drawable" or drawable-hdpi. Test it in all the devices. It should work fine. Tip: put the image that will look Good in 10.1 WXGA, Automatically, the Lower size screen will look good.

编辑:创建的比率图像的 3:4:6:8

例:如果你有宽度的图像: 120px 高度:90px 作为低分辨率设备(绘制-LDPI),那么,对于绘制-MDPI为3:4 (120x4 / 3)= 160   
绘制-MDPI 图片大小应为 W:160px,高:120px   
绘制 - 华电国际图片大小应为 W:240px,高:180px (两次LDPI的)   
绘制-xhdpi 图片大小应为 W:320px的,H:240px (MDPI的两倍)

EDIT : Create image of the Ratio 3:4:6:8

Ex: if you have an image of width:120px and Height:90px for low resolution devices (drawable-ldpi), then, for drawable-mdpi is 3:4 (120x4/3) = 160
drawable-mdpi the image size should be W:160px , H:120px
drawable-hdpi the image size should be W:240px , H:180px (twice of ldpi)
drawable-xhdpi the image size should be W:320px , H:240px (twice of mdpi)

请确保你所有的图片都是 质量好,即使是不同的尺寸。

Make sure that all your images are of good quality, even if it's of different dimensions.

请参考:如何支持多画面

这篇关于根据屏幕尺寸调整你的形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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