S.Hossein Emadi
S.Hossein Emadi

Reputation: 79

sub folder for layout in android studio

I developing an android project for my university. My layout folder is too big, and i decide to create sub folder in my layout folder.

I read this answer and question but this is not work for me.

android {
compileSdkVersion 23
buildToolsVersion "23.0.1"

defaultConfig {
    applicationId "example.google.com.widgetforlockscreen"
    minSdkVersion 8
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

sourceSets {
    main {
        res.srcDirs =
                [
                        'src/main/res/layouts/layouts_category2',
                        'src/main/res/layouts',
                        'src/main/res'


                ]
    }
}
}

but nothing create for me.

Upvotes: 1

Views: 7673

Answers (1)

Msp
Msp

Reputation: 2493

Gradle won't create any directories for you. You have to create the following directory structure,

- res/layouts
    - layout
        - layout1.xml
    - layouts_category2
        - layout
            - layout2.xml

Like this, we can use Gradle's ability to merge multiple resource folders. Note that it's not an Android feature.

Upvotes: 5

Related Questions