Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: structuring of layout files (e.g. like in subfolders)

Is there a way to structure layout files, e.g. like in subfolders (as subfolders of resources are not supported)?

I have many layout files which all lie in the layout folder. This gets pretty

is it possible to somehow structure them, by tags, by subfolders or something else?

E.G.:

  • layout
    • screen A
    • screen B

or

  • layout
    • fragments
    • activities

or

  • layout
    • component A
    • component B
like image 888
McOzD Avatar asked Nov 10 '22 07:11

McOzD


1 Answers

Yes, you can have multiple resource folders in your project using Gradle.

It allows you to organize not only your layout files but any kind of resources.

This is how the configuration looks like:

sourceSets {
    main {
        res.srcDirs = ['src/main/res', 'src/main/res2']
    }
}

Documentation

Example Project

like image 67
Machado Avatar answered Nov 14 '22 22:11

Machado