优点:
Anko库可以使开发者用更少的代码表示编程含义,让代码更加简单易懂。
android studio 3.1版本内置Anko,不需要重新引入
一、gradel配置(module):
implementation "org.jetbrains.anko:anko-appcompat-v7-listeners:$ankoVersion"
implementation "org.jetbrains.anko:anko-design-listeners:$ankoVersion"
implementation "org.jetbrains.anko:anko-design:$ankoVersion"
implementation "org.jetbrains.anko:anko-sdk15-listeners:$ankoVersion"
implementation "org.jetbrains.anko:anko-sdk15:$ankoVersion"
implementation "org.jetbrains.anko:anko-sqlite:$ankoVersion"
二、gradel配置(module):
ext.ankoVersion = "0.10.4“
三、重新编译
四、举例说明Anko的方便
不使用Anko:
var t = Toast.makeText(this,"...",Toast.LENGTH_LONG)
t.show()
使用Anko:
longToast("anko.....")
完。