Android studio mipmap and 9-patch drawables

喜你入骨 提交于 2019-12-08 00:52:05

问题


I am facing strange issue trying to put 9 patch drawables into new android studio mipmap directories. I've put all the images to specified folders, just as I used to do with drawable, but when I try to include it in a project it says

Cannot resolve symbol @mipmap/myfile

but it definitely "finds" it as you can see at the screenshot.

I think it cannot resolve the symbol because the "real" filename has .9, but dots cannot be used in defining drawable. ( I tried, it didn't work :) )

Is someone esle is facing same problem? Currently, I've added the drawables folders and defined everything eclipse-style and it is working, but It is ugly way to resolve the problem. Thank you.


回答1:


You must add all your 9-patch images to drawable folder and use it by referencing @drawable/your_image_name.

For more information refer Android Developers Blog




回答2:


Compilation and IDE resolution are 2 different things. Android studio can find your mipmap image but the android sdk does not support naming convention with 2 dots when you try to compile. Just rename your image to greenbuttonbg.png.



来源:https://stackoverflow.com/questions/28742085/android-studio-mipmap-and-9-patch-drawables

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