广播按钮setOnClickListener无法完全运行
我正在开发一个移动应用程序,其中使用了无线电按钮。奇怪的是,无线电按钮的SetOnClickListener无法运行完整的代码。这是我的广播按钮的代码,
radioButtonWeekly.setOnClickListener {
btnSelectWeek.isEnabled = true
btnSelectWeek.setBackgroundColor(Color.WHITE)
btnSelectMonth.isEnabled = false
btnSelectMonth.setBackgroundColor(Color.GRAY)
Log.i("${PerformanceFragment::class.java.simpleName}: ", "Selected Week No: ${selectedWeekNo}")
}
仅在上面的四个语句运行。最后一个语句(log.i)不运行。实际上,上面的任何四个语句都不运行。请说明发生了什么事?
I am working on a mobile app in which I have used the radio buttons. The strange thing is that the radio button's setOnClickListener does not run complete code. Here is the code of my radio Button
radioButtonWeekly.setOnClickListener {
btnSelectWeek.isEnabled = true
btnSelectWeek.setBackgroundColor(Color.WHITE)
btnSelectMonth.isEnabled = false
btnSelectMonth.setBackgroundColor(Color.GRAY)
Log.i("${PerformanceFragment::class.java.simpleName}: ", "Selected Week No: ${selectedWeekNo}")
}
Only the above four statements run. The last statement (Log.i) does not run. In fact, any statement below the above four statements does not run. Please explain what is going on wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先创建无线电组
,然后用于手柄无线电按钮
源 https://develovelvelvementer.android.android。 com/guide/topics/ui/controls/radiobutton
first create radio group
then for handle radio buttons
source https://developer.android.com/guide/topics/ui/controls/radiobutton