Unable to understand the drawable structure inside res folder

[亡魂溺海] 提交于 2019-12-11 07:36:24

问题


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

I am little bit confused about drawable folders.

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.

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?

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

Please clear my doubts regarding this.

Thanks

Pankaj


回答1:


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

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


should drawable-de-rDE will be sufficient?

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.




回答2:


http://developer.android.com/guide/topics/resources/localization.html



来源:https://stackoverflow.com/questions/5537208/unable-to-understand-the-drawable-structure-inside-res-folder

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!