简体   繁体   中英

How to use single drawable for all screen resolutions in Android programming?

Android programming in eclipse, java, xml etc. I put all the drawables (images, xml files etc) in all the folders: mdpi, hdpi etc. So I have 4 copies of each file.

Is this absolutely necessary ?

Is there a way I can put them in a single "drawable" folder ?

Or will android understand that if the file does not exist in hdpi, it should fetch it from mdpi, or wherever the file exists ?

Yes, it will fetch the appropriate file if that particular image is not available in other folder. But it need to atlest in one folder(drawable OR mdpi OR hdpi OR ldpi ...)

Yes you can put all the images in single drawable folder.But in this case if you have a low resolution image this will be look as faded image in the case of tabs

so if you want your application support in all devices, Tabs then you have to put images in different drawable folder like as drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi

为什么不使用https://code.google.com/p/9patch-resizer/自动将图片大小调整为与Android开发兼容的所有分辨率?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM