如何绘制机器人自动改变? [英] How android drawable automatically change?

查看:120
本文介绍了如何绘制机器人自动改变?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Android应用程序,它使用许多图像。和应用是可以在不同的分辨率使用。我只用一组图像和图像保存在绘-MDPI。
因此,图像得到,当我在高分辨率运行模糊。
所以可能这个解决方案是保存不同分辨率的不同图像绘制,华电国际,LDPI等。

I have a android application, that uses many images. and application is to be used on different resolutions. I am using only one set of images and images are saved in "drawable-mdpi". So "The images gets blur when I run it on a high resolution". So probably the solution of this is to save different images of different resolution in drawable-hdpi,ldpi etc.

在做这就够了或做我必须改变由code图像?或电话自动调整图像perfact到可绘制。

Is doing this is enough or do I have to change the images by code? or phone automatically adjust the perfact image into the drawables.

有谁能够提供一个例子?

can anybody provide a example??

推荐答案

如果你把图片中的 LDPI,MDPI,华电国际 xhdpi 文件夹的Andr​​oid根据当前设备DPI选择图像。

If you put the images in the ldpi,mdpi,hdpi or xhdpi folders Android chooses the images according to the current device dpi.

如果你只添加 MDPI ressources并加载它们一个华电国际设备上的Andr​​oid将扩大与一个因素图像的 1.5 如果你打开​​他们,他们将与因子来缩水了 LDPI 设备0.75
该应用缩放,使图像具有(几乎)相同的物理尺寸显示所有与任何dpi的。

If you only add mdpi ressources and load them on a hdpi device Android will enlarge the images with a factor of 1.5 if you open them on a ldpi device they will be shrunk with a factor of 0.75. The scaling is applied so that the images have (almost) the same physical size all displays with any dpi.

您应该为每个DPI添加不同的图像,如果这些图像会自动缩放这种模糊后(收缩时或松散的细节)。如果您有缩放照顾好简单的图像,你只需要一个图像添加到任何DPI文件夹中。

You should add different images for each dpi if those images will be blurry (or loose details when shrinked) after this autoscaling. If you have simple images that look well after scaling you only need to add one image to any dpi folder.

编辑:
在Android上有自动选择取决于屏幕分辨率的图象没有默认的方式。由于文档说:

On Android there is no default way for automatically selecting images depending on the screen resolution. As the docs says:

当为多种屏幕添加支持,应用程序并不直接与分辨率的工作;应用程序应该只与屏幕尺寸和密度而言,如通过广义的尺寸和密度分组

When adding support for multiple screens, applications do not work directly with resolution; applications should be concerned only with screen size and density, as specified by the generalized size and density groups.

(见支持多种屏幕)。

这篇关于如何绘制机器人自动改变?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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