I just generated some 9 patch images with
https://romannurik.github.io/AndroidAssetStudio/nine-patches.html
This outputs some subfolders of drawable
like drawable-hdpi
, drawable-xhdpi
, etc.
I pasted them in the drawable folder and currently got multiple images in multiple folders.
However, when I want to use the image, it needs to be in the drawable
folder as well (not any subfolders) otherwise Android Studio can't find the image.
Do I need to paste an hdpi (or something else?) 9 patch image into the drawable folder so it can find it and will the 9 patch images still work for multiple screen sizes?
It sounds like you put the density-specific folders (e.g. drawable-hdpi
) inside the drawable
folder. This is incorrect. The density-specific folders should be at the same level as the drawable
folder.
For example:
├── app
├── main
├── res
├── drawable
├── drawable-mdpi
├── drawable-hdpi
The drawable
folder is used for drawables that do not need density-specific variants.