Can the Android drawable directory contain subdirectories?

后端 未结 21 1228
醉梦人生
醉梦人生 2020-11-22 04:13

In the Android SDK documentation, all of the examples used with the @drawable/my_image xml syntax directly address images that are stored in the res/drawable directory in my

21条回答
  •  滥情空心
    2020-11-22 04:36

    There is a workaround for this situation: you can create a resVector (for example) folder on the same level as default res folder. There you can add any drawable-xxx resource folders there:

    resVector
    -drawable
    -layout
    -color
    

    After that all you need is to add

    sourceSets {
            main.res.srcDirs += 'src/main/resVector'
        }
    

    into your build.gradle file (inside android { }).

提交回复
热议问题