Modularity of resource files via Gradle configuration under Android Studio

Source: Internet
Author: User

When the development of a large number of application modules, resource files will be particularly large, layout will be more up, when all the layout is placed in the same directory, it will appear bloated, and not good to find the corresponding layout.

Recently saw the data, found in Android Studio can be configured multiple res directory, used to split different modules.

As shown, you can create a variety of resource directories in the Res directory of a new module:

Of course, you can also create directories such as Drawable,values in the RES-QA directory

These resource files can be referenced as directly as the original R file.

The above is only an effect and needs to be configured in Build.gradle

Android {    ...    sourcesets {       + = ' Src/main/res-qa        ' + = ' src/main/res-wb '    }}

or the following form

Android {   ...    sourcesets {//        main.res.srcDirs + = ' Src/main/res-qa '//         Main.res.srcDirs + = ' src/main/res-wb '        + = [' Src/main/res-qa ', ' SRC/MAIN/RES-WB '    }} 

Reference Link: http://antonioleiva.com/android-multiple-resource-folders/

Modularity of resource files via Gradle configuration under Android Studio

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.