【发布时间】:2021-05-28 14:38:50
【问题描述】:
当我输入文本时,我会在警报对话框中看到此输出。
有人能解释一下为什么会这样吗?
logcat 中没有错误。
这是我的警报对话框代码
private fun declineDialogBox() {
val dialogBuilder = AlertDialog.Builder(this)
val inflater = layoutInflater
val dialogLayout = inflater.inflate(R.layout.alert_dialog, null)
val toBeCorrected = dialogLayout.findViewById<EditText>(R.id.editText)
dialogBuilder.setMessage("Reason is?")
.setCancelable(false)
.setPositiveButton("Proceed") { dialog, id ->
finish()
Toast.makeText(applicationContext, "Reason is $toBeCorrected", Toast.LENGTH_SHORT)
.show()
}
.setNegativeButton("Cancel") { dialog, id ->
}
val alert = dialogBuilder.create()
alert.setView(dialogLayout)
alert.setTitle("To Be Corrected")
alert.show()
}
【问题讨论】:
标签: kotlin android-edittext android-alertdialog