单选按钮没有突出显示,就像它们被选中一样
我正在开发一个带有包含 10 个 RadioButtons 的 RadioGroup 的 Android 活动。有时出于某种原因,仅有时,当您在 RadioGroup 中选择 RadioButton 时,它不会突出显示,就像它已被选中一样,但通过一些测试,我确定它确实已被选中,即使它没有突出显示。发生的另一件奇怪的事情是,当您选择 RadioGroup 中的任何其他 RadioButton,然后尝试选择原始的 Radio Button(不会突出显示的单选按钮,就像它被选中一样)时,它会突出显示并正常运行。
知道为什么会发生这种情况或如何解决它吗? 谢谢!
I'm working on an android activity with a RadioGroup containing 10 RadioButtons. For some reason or another sometimes, only sometimes, when you select a RadioButton in the RadioGroup it doesn't highlight as if it's selected but through some tests I've determined that it really IS selected even though it isn't highlighted. Another odd thing that occurs is that when you select any other RadioButton in the RadioGroup and then try selecting your original Radio Button (the one that wouldn't highlight as though it were selected) it does highlight and functions as normal.
Any idea why this is happening or how to fix it?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要设置单独的RadioButton.setSelected(false),而是使用RadioGroup.clearCheck()。这对我有用:-)
Instead of setting individual RadioButton.setSelected(false), Use RadioGroup.clearCheck(). This worked for me :-)
使用这个概念来提取选中的单选按钮的正确值。
Use this concept for extracting the correct value of checked radiobutton.