简体   繁体   中英

Android Studio doesn't recognize 9patch images in drawables

I have a nine patch image and gave it a name like this:

img.9.png

When I import it into drawable-hdpi or drawable-xhdpi folders and so on android studio is unable to recognize image and gives me an error :

Couldn't resolve resource @mipmap/img.9
Failed to convert @mipmap/img.9 into a drawable

Error:(69, 29) No resource found that matches the given name (at 'background' with value '@drawable/img').

Also when I import this 9patch image into drawable folder android studio displays it correctly but when I build and run application give an error:

Error:(69, 29) No resource found that matches the given name (at 'background' with value '@mipmap/img.9').

The extension must be .9.png but you don't have to include .9 in your reference!
So, it's not @mipmap/img.9 , but @mipmap/img

Moreover, mipmap shoul only be used for the launcher icon, not for the graphic resources.

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