版權聲明:本文爲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