With default resources in the drawable folder (MDPI sized) what's the point of the drawable-mdpi folder?

江枫思渺然 提交于 2019-12-03 06:25:19

You don't need to duplicate your resources. A good practice is to do the following: - Put all non image-based drawables inside res/drawable/ (for instance all your XML drawables) - Put all image-based drawables (images and 9-patches) inside res/drawable-mdpi, res/drawable-hdpi, etc.

All I would say, is that obviously Romain guy is correct about using drawables to keep xml files in and then moving image resources into the relevant mdpi, hdpi and ldpi folders, the only time I'd go against this is when you wish to target 1.5 devices.

The reason for this is that because 1.5 has no recognition for the -hdpi, -mdpi and -ldpi tags, it ignores them and picks resources (seemingly randomly) from each folder, so instead you have to add the following flag -hdpi-v4, -mdpi-v4, -ldpi-v4, this will then make those folders accessible by 1.6+ versions of Android forcing 1.5 to only see the drawable folder, at which point you need to have all your resources in drawable, which then removes the need to have the drawable-mdpi folder.

However, since 1.5 is getting on a bit and such few devices have it, it makes more sense to target 1.6+ and ignore this complication.

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