添加依赖
dependencies {
compile "org.jetbrains.anko:anko-commons:$anko_version"
}
Color
0xff0000.opaque 不透明的红色
Dimensions
使用dip和sp:dip(dipValue)或者sp(spValue)
applyRecursively()
applyRecursively()应用于lambda表达式的本身,然后递归地运用在他的子view
verticalLayout {
editText {
hint = "Name"
}
editText {
hint = "Password"
}
}.applyRecursively { view -> when(view) {
is EditText -> view.textSize = 20f
}}
以上表示,该layout中的editext的textSize都为20sp