在用java开发Android的时候有很多方便的库如:butterknife,rxjava等,但kotlin的使用很多原来java上方便的库,在kotlin上不再方便。
在Gralde中配置:
apply plugin: 'kotlin-android-extensions'
之后可以kotlin 快速导入view
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
androidExtensions {
experimental = true
}
}
实体
@Parcelize data class MyData(var message:String,var hehehe: Boolean,var temp :Int):Parcelable
project : build.gradle 项目的gradle配置
buildscript {
repositories {
maven { url 'https://www.jitpack.io' }
}
项目里配置
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
androidExtensions {
experimental = true
}
}
kapt com.github.smartbackme.AutoPage:autopage-processor:1.0.7
implementation com.github.smartbackme.AutoPage:autopage:1.0.7
就可以实现页面急速跳转
ApMainActivity2.newInstance().apply {
message = "123"
} .start(this)
github地址:https://github.com/smartbackme/AutoPage
debugImplementation com.squareup.leakcanary:leakcanary-android:2.0-beta-1
github地址:https://www.github.com/square/leakcanary
implementation 'com.orhanobut:logger:2.2.0'
github地址:https://github.com/orhanobut/logger
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
github地址:https://github.com/square/okhttp
github地址:https://github.com/bumptech/glide
dependencies {
implementation 'com.tencent:mmkv:1.0.23'
}
github地址:https://github.com/scwang90/SmartRefreshLayout/
ImmersionBar 沉浸式状态栏
github地址:https://github.com/gyf-dev/immersionbar
BaseRecyclerViewAdapterHelper 非常好用Recyvlerview适配器
github地址:https://github.com/CymChad/BaseRecyclerViewAdapterHelper