Android 腾讯UI界面插件QMUI环境搭建及沉浸式顶部实现方法(针对kotlin)

QMUI是腾讯针对Android系统开发的一套UI界面插件,功能丰富强大,重点是原生Android开源,现就将QMUI在Android Studio 3.5.2下的配置方法以及如何实现沉浸式顶部的方法讲解如下。
首先配置QMUI使用环境,build.gradle(Module)配置如下,注意粗体标注部分:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.gsgwyks"
minSdkVersion 19 //最低API版本19以上
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.qmuiteam:qmui:2.0.0-alpha02'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
def qmui_arch_version = '2.0.0-alpha02'
implementation "com.qmuiteam:arch:$qmui_arch_version"
kapt "com.qmuiteam:arch-compiler:$qmui_arch_version"
}

最后将样式表style.xml 修改如下就可以正常使用QMUI界面了