如何在Kotlin中为EditText addTextChangeListener构建lambda表达式?下面给出了一个错误:
passwordEditText.addTextChangedListener { charSequence ->
try {
password = charSequence.toString()
} catch (error: Throwable) {
raise(error)
}
}
如何在Kotlin中为EditText addTextChangeListener构建lambda表达式?下面给出了一个错误:
passwordEditText.addTextChangedListener { charSequence ->
try {
password = charSequence.toString()
} catch (error: Throwable) {
raise(error)
}
}
这看起来很整洁:
passwordEditText.setOnEditorActionListener {
textView, keyCode, keyEvent ->
val DONE = 6
if (keyCode == DONE) {
// your code here
}
false
}