问题
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