The folders of an Android application follow a well-defined folder structure and names.
"Android" view does not fully reflect the hierarchy of folders in the project, only the "type" folders that comprise this structure are displayed, for example, folders with qualifiers are not listed.
Note that only a / res / mimpap folder appears, although there are / res / mipmap-hdpi, / res / mipmap-mdpi folders, etc.
Note that the folder names you mentioned, raw, anim, menu, color, and xml are listed because they are part of list of defined names for resources .
Although you can create other folders, they are not recognized as having resources , you will not be able to reference the files in both the code and xml because an entry is not generated in the R .
It is, however, possible to have these folders ( list ) within another which not only src/main/res
, can create others such as src/main/res2
. Use the build.gradle file, the res.srcDirs
property in block sourceSets
to indicate them as a resources folder.
android{
....
....
sourceSets {
main {
res.srcDirs += ['src/main/res2']
}
}
}
To view all the folders choose the "Project" or "Packages" views.
----------------------------------------------- -------------------------------------------------- -------
To create a subfolder in / res you must right-click on it and choose new -> Android resource directory strong>
Openwizardshouldchoosetheresourceandthequalifiertoapply,donotmesswithDirectoryName.
ThefollowingexampleshowshowtocreatearesourcefolderoftypelayoutandwiththequalifierPortaint.
Normallyitisnotnecessarytocreatethesefolderswhencreatingafileoftype"Android resource file", if the folder does not exist it will be created.
Inthewizardthatopensenterthenameoftheresource,chooseyourtypeandqualifier,besidesthefilewillalsobecreated(ifthereisnot)therespectivefolderwiththequalifier.