I have my image resources in the various mipmap
folders (mipmap-xhdpi
, mipmap-xxhdpi
, etc.) My project has hundreds of images (and growing) and it is becoming cumbersome that they are all in a single level in each directory.
I want to create a subfolder, such as "sprites" that I can reference in code with something like
R.mipmap.sprites.sprite_name
How can I create usable sub-folders in my mipmap folders?
When I create a new directory inside of a mipmap folder (using New -> Directory
), the directory and its contents are invisible to anywhere that I am specifying a resource, namely:
• In the design-view of my xml layout, when I am browsing for an image resource for a background or an image button, the sub folders are hidden.
• In code, when I am specifying an image resource (R.
... the subfolders are ignored).
Is there a correct way to do this? There appear to be some other directory options, Under the New -> Folder
category, I have:
• Assets folder
, described as "create a source root for assets to be included in the apk," but I don't want a root, I want a subdirectory.
• Res Folder
, "source root for android resource files" 1. I don't see how this is different than an asset and 2. again, I don't want a root.
There are also several other folder types listed, that I am not familiar with.
If this cannot be accomplished, what is the correct way to include (and organize) hundreds (or thousands) of image resources in a project? Is the only way to do it really to have them all in a single directory?