先看一下分包后的样子,不只是layout,还有drawable及value,
方法很简单,配置我们的build.gradle文件:
android {
...
sourceSets {
main {
res.srcDirs =
[
'src/main/res/layouts',
'src/main/res',
'src/main/res/layouts/home',
'src/main/res/layouts/hot_sale',
'src/main/res/layouts/amuse',
'src/main/res/layouts/delicacy',
'src/main/res/layouts/food_management',
'src/main/res/layouts/settings',
]
}
}
}
配置完之后,sync project一下就可以了。