Android Organise Layouts into Sub Folders

前端 未结 4 804
无人及你
无人及你 2020-12-16 10:14

I have a fairly complex android app, the contents of the \'layout\' folder is becoming increasingly large. I\'ve tried to organise the individual layout xml files into sub f

相关标签:
4条回答
  • 2020-12-16 10:33

    Another option is to use a prefix for your different views. Is not as nice as having different folder but it can introduce some order.

    0 讨论(0)
  • 2020-12-16 10:45

    I don't think you're going to be able to do this. I believe that it only supports certain folder names like layout-large, layout-mdpi, layout-hdpi, layout-fr, etc. You can use more than one of these modifies as well like layout-fr-hdpi-large.

    This page shows all of the allowed modifiers

    http://developer.android.com/guide/topics/resources/providing-resources.html

    0 讨论(0)
  • 2020-12-16 10:50

    Now with Android Studio and Gradle, you can have multiple resource folders in your project. Allowing to organize not only your layout files but any kind of resources.

    It's not exactly a sub-folder, but may separte parts of your application.

    The configuration is like this:

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

    Check the documentation.

    0 讨论(0)
  • 2020-12-16 10:50

    Hi a good example is posted here please refer https://plus.google.com/u/0/+DmytroDanylyk/posts/bjYgPZFK1ti?cfem=1

    0 讨论(0)
提交回复
热议问题