无法理解res文件夹中的可绘制结构 [英] Unable to understand the drawable structure inside res folder

查看:60
本文介绍了无法理解res文件夹中的可绘制结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就Android应用程序开发而言,我是新手.

I am newbie as far as android application development is considered.

我对可绘制文件夹有点困惑.

I am little bit confused about drawable folders.

在android开发人员网站上可用的教程中,他们提到了drawable文件夹.但是当我创建android 2.3.3应用程序时,我看到三个文件夹 drawable-hdpi drawable-mdpi drawable-ldpi .

In the tutorials available on the android developer site they have mentioned about the drawable folder. But when I create android 2.3.3 application I see three folders drawable-hdpi, drawable-mdpi and drawable-ldpi.

我知道这是针对屏幕分辨率的.如果我有一个图像作为资源,则必须创建三个具有不同大小的等效图像,并将这些图像放入这三个文件夹中.

I know that this for screen resolutions. If I have an image as a resource I have to create equivalent three images with different sizes and put these images into these three folders.

但是例如,我正在使用图像进行本地化(德语).我应该创建类似 drawable-mdpi-de-rDE drawable-ldpi-de-rDE 的文件夹 drawable-hdpi-de-rDE 还是 drawable-de-rDE 是否足够?

But for example, I am working on a localization (German) with images. Should I create folder drawable-hdpi-de-rDE similarly drawable-mdpi-de-rDE and drawable-ldpi-de-rDE or should drawable-de-rDE be sufficient?

如果 drawable-de-rDE 足够,如果以mdpi或ldpi运行,会发生什么?

If drawable-de-rDE is sufficient what will happen if it is run in mdpi or ldpi?

请清除我对此的怀疑.

谢谢

Pankaj

推荐答案

我应该创建文件夹吗drawable-hdpi-de-rDE类似drawable-mdpi-de-rDE&drawable-ldpi-de-rDE

Should i create folder drawable-hdpi-de-rDE similarly drawable-mdpi-de-rDE & drawable-ldpi-de-rDE

如果您想自己制作照片(以合适的尺寸),是的,您必须创建特定于文化和像素密度的目录.但是,文化应该在dpi之前出现,否则项目将无法编译.例如,以下代码将正确编译:

If you want to make your pictures (at the right sizes) yourself, yes, you'll have to create directories that are specific to both the culture and pixel density. However, the culture should come before the dpi, or the project will not compile. For example, the following would compile correctly:

drawable-de-rDE-hdpi
drawable-de-rDE-mdpi
drawable-de-rDE-ldpi

drawable-de-rDE-hdpi
drawable-de-rDE-mdpi
drawable-de-rDE-ldpi

drawable-de-rDE应该是足够吗?

should drawable-de-rDE will be sufficient?

如果您自己不需要以合适的比例绘制图片,那应该可以:android会根据需要将图像缩放到合适的尺寸.

If you don't feel the need to draw your pictures at the right scale yourself, that should work : android will scale the images to the right size, as needed.

但是请注意,您可能会得到更好的图形来进行自我缩放-而且,您不仅可以重新缩放图像,还可以重新考虑一下图像的大小,以便更好地适合不同大小的图像.

But note that you might get better graphics doing that scaling yourself -- and, instead of just scale up/down, you could re-think your images a little bit, so they fit better in different sizes.

这篇关于无法理解res文件夹中的可绘制结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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