I trying to sort out src/main/res/layout
xml files to make layouts files clear display function module, I created some functions folder in the res/layout folder, and move corresponding XML files in this folders.
And i use following code in the build.gradle(:app)
:
android {
//other codes
sourceSets {
main {
res.srcDirs =
[
'src/main/res/layout/exampleFunction1',
'src/main/res/layout/exampleFunction2/exampleFunction4',
'src/main/res/layout/exampleFunction3',
'src/main/res/layout',
'src/main/res'
]
}
}
But in the activity_main.xml,the xml layout was error, because i just use tags:
<include layout="@layout/main_examplexml_name <!--ERROR-->
android:layout_height="match_parent"
android:layout_width="match_parent" />
Xml Include Tags Error Pic
At time,in MainActivity.java
,init()
funcation:findviewByID is error too.
In developer documents like no description in this demand,just this course:
Re-using Layouts with
Reference
【Android Studio】分类整理res/Layouts中的布局文件(创建子目录)
question from:
https://stackoverflow.com/questions/66058735/how-to-fix-include-tags-id-s-error-when-i-use-sourcesets-res-srcdirs-to-so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…