Issue
I found that back in 2009, it was impossible to insert sub-directories for the Drawable folder (Can the Android drawable directory contain subdirectories?).
Since it has been more than ten years from then, I wonder if Android Studio ever updated a way to insert sub-directories to group images together. I added more than 80 images in the Drawable folder, and it's pretty bugging me... Thanks!
Solution
No, the Android resources mechanism doesn't support any custom directory or subdirectory yet (instead of the assets for example).
However, you can implement a structure similar to:
|--- res
|
|--- circles
| |--- drawable
| |--- my-circle.xml
|
|--- triangles
| |--- drawable
| |--- my-triangle.xml
|
|--- selectors
|--- drawable
|--- my-selector.xml
And with Gradle you can add src/main/circles
, src/main/triangles
and src/main/selectors
to your res
directories.
e.g.
android {
sourceSets {
main.res.srcDirs += ['src/main/circles', 'src/main/triangles', 'src/main/selectors']
}
}
Answered By - Giorgio Antonioli
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.