When creating folder inside folder / res it is not visible in the left panel

3

When I put the name of the new folder and press Enter, that same folder does not appear on the left side of the Project nor can I reference the path of it.

The strange thing is that if I put the name of the folder as raw, anim, animator, menu, color, xml it appears, other names not already. I can not create hierarchy between folders at all.

    
asked by anonymous 01.09.2016 / 11:59

3 answers

5

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.

    
01.09.2016 / 17:13
3

I suggest you change the way you view your project. Test using Project Files mode ... In this mode you have access to the file structure, through the Studio file manager.

t +

    
01.09.2016 / 13:54
2

The RES folder does not allow you to create subfolders. You can use a plugin to simulate folders in RES based on file names.

Name: Android File Grouping

To add to the IDE, press ctrl + alt + s and go to Plugins and search for Android File Grouping. To use, click the layout folder with the right and go to Group (must go in the "Project" view)

    
01.09.2016 / 16:16