如何在填充 editText 条目之前禁用按钮?
How to disable a button until editText entries are filled?
以下是我根据 editText 条目禁用和启用按钮的代码。这里没有错误,但是我的应用程序一直在崩溃。任何人都可以在这里帮助我..!
editTextNumberDecimal2.addTextChangedListener (object : TextWatcher1 {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
TODO("Not yet implemented")
button2.isEnabled = false
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
TODO("Not yet implemented")
button2.isEnabled = s.toString().trim().isNotEmpty()
}
override fun afterTextChanged(s: Editable?) {
TODO("Not yet implemented")
}
})
只需删除这些行:
TODO("Not yet implemented")
以下是我根据 editText 条目禁用和启用按钮的代码。这里没有错误,但是我的应用程序一直在崩溃。任何人都可以在这里帮助我..!
editTextNumberDecimal2.addTextChangedListener (object : TextWatcher1 {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
TODO("Not yet implemented")
button2.isEnabled = false
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
TODO("Not yet implemented")
button2.isEnabled = s.toString().trim().isNotEmpty()
}
override fun afterTextChanged(s: Editable?) {
TODO("Not yet implemented")
}
})
只需删除这些行:
TODO("Not yet implemented")