版权声明:本文为HaiyuKing原创文章,转载请注明出处!html
通常用于分类显示不一样模块的layout布局文件。android
res/layout鼠标右键——New——Directoryapp
res/layout/home鼠标右键——New——Directory布局
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.why.project.helloworld"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//在layout文件夹下创建子文件夹 sourceSets { main{ res.srcDirs = [ 'src/main/res/layout/home', 'src/main/res/layout', 'src/main/res' ] } }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':baselibrary')
}
注意:每新建一个子目录,就须要添加一行相似'src/main/res/layout/home',的代码。gradle
至此,添加完成。ui
Android Studio分类整理res/Layout中的布局文件(建立子目录)spa
Android中layout创建子文件夹用来放置不一样种类布局.net