在调整屏幕QVGA图像 [英] Resize image on QVGA screens

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

问题描述

我有一个登录界面的应用程序。在该屏幕上,我去公司的标志。

I have an app with a login screen. On that screen, I have de company logo.

首先,我做了一个布局文件夹和一个可绘制文件夹。我测试了所有的工作确定。

First I made one layout folder and one drawable folder. I tested and all worked ok.

然后,我添加了4布局文件夹(正常,大,小,超大)和4绘制文件夹(华电国际,LDPI,MDPI,xhdpi)。
我刚才复制我的logo.png和我main_layout.xml每个文件夹(这就是错误的,但只是测试)。
当然了,当我测试的每一个型动物屏幕尺寸仿真器上的应用程序,它显示了错误的位置或变形(大一些时间或更小,在位置不好等时间,等)的标志形象。并且那是对的,因为我没有创造不同的PNG文件,我并没有适合diferent大小的布局。

Then I have added the 4 layout folders (normal, large, small and xlarge) and the 4 drawable folders (hdpi, ldpi, mdpi, xhdpi). I just copied my logo.png and my main_layout.xml to each folder (thats wrong, but was just for test). Off course, when I test the app on the each differents screen size emulators, It shows the logo image in wrong position or deformed (Some times bigger or smaller, other times in bad position, etc). And thats is right, because I didn't have created the different png files and I didn't have adapted the layouts for diferent sizes.

所以,下一步是与德兴面积谈话,并要求在4 PNG文件每个密度和检查4布局。

So, the next step it was talk with the desing area and ask for the 4 png files on each density and check the "4 layouts".

一旦我有4 PNG文件和固定的布局,我已经使用了4仿真器(一个标准屏幕,其余为大屏幕,其他额外的大屏幕和一个小屏幕),再次测试的应用程序。而且还是不行像我想要的。

Once I have the 4 png files and the layouts fixed, I have tested again the app using the 4 emulator (one for normal screens, other for large screens, other for extra large screens and one for small screens). And still not work like I want.

在某些情况下,logo.png它显示了更大的什么我想要的。在别人显示出较小。
我不明白我必须做的。
我用WRAP_CONTENT,我创建了4绘制文件夹(华电国际,LDPI,MDPI,xhdpi),我有不同的尺寸4 logo.png文件。

On some cases, the logo.png it shows bigger that what I want. In others It show smaller. I don't understand what I have to do. I use wrap_content, I create the 4 drawable folders (hdpi, ldpi, mdpi, xhdpi), I have 4 logo.png files with different sizes.

但是,当我看到一个QVGA仿真器(例如)图像时,它给我一个巨大的形象。

But when I see the image on a QVGA Emulator (for example), it show me a huge image.

如果不同的布局是屏幕尺寸,不同的PNG图像是不同密度的,我要做的使用小或更大的图片(PNG格式)??

If the different layouts is for the screen size, and the different pngs is for the different density, What I have to do to use small or bigger image (pngs)??

感谢和我的英文不好对不起

thanks and sorry for my poor english

推荐答案

这类型的问题通常是非常特殊的情况下

This type of problem usually is very case specific.

但一般的方法是有一个且只有一个布局。
这种布局内的任何尺寸值,放在/价值/文件夹内的文件dimens.xml。
创建4巴纽(LDPI,MDPI,华电国际,xhdpi),并确保他们的比例是正确的! (仔细检查Android开发网站上看到正确的比例。

But the general approach is to have ONE and only ONE layout. Any dimension values inside this layout, put in a dimens.xml file inside the /values/ folder. Create the 4 .png (ldpi, mdpi, hdpi, xhdpi) and make sure their proportion is correct! (Double check the Android developers website to see the correct proportions.

和你以后再这样设置的测试,如果有什么东西没有对准将创建该屏幕尺寸dimens.xml(小,大,等),只会增加你真正想要的尺寸发生变化。

And after you tested with this setup, IF there's something not aligning you'll create a dimens.xml for that screen size (small, large, etc) and only add the dimension you actually want to change.

不要测试之前添加的所有维度或全部布局。通常简单开始与基本和根据需要添加更多的资源。

Do not add all dimensions or all layouts before testing. Is usually simpler to start with the basic and add more resources as needed.

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

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