Android模拟器复选框和无线电按钮错误 - UI上显示了各种不正确的状态
最近,我发现了奇怪的模拟器行为,显示了无线电按钮和复选框。它不具有2个UI状态,或者更具体地说,它显示了4个不同甚至更多的状态。我想它们是冷冻的动画状态。在布局检查器和较新版本的API上,它看起来正常。请参阅下面的图片:
我在API版本中发现了它:23和24。在28和30上,它的行为正确。
因此,问题是:这真的是模拟器的问题,并且不会在真实设备上发生吗?也许这是某些设置的问题?
编辑:它不仅在模拟器上发生。
Recently I've spotted weird emulator behaviour with showing the radio buttons and checkboxes. Instead of having only 2 states of UI it has or to be more specific it shows 4 different or even more. I suppose they are frozen animation states. On the layout inspector and on the newer version of the API it looks normal. See the pictures below:
I spotted it at Api versions: 23 and 24. And on 28 and 30 it behaves correctly.
So the question is: is it really a problem of the emulator and it won't happen on real devices? Or maybe it is a matter of some settings?
Edit: It is happening not only on emulators.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了这种不正确的复合按钮状态的原因。这是因为我使用插图在这样的按钮之前添加左填充物:
我试图找到一种方法来添加不同的填充方法,但我最终将每个按钮包裹着其他Framelayout并在此处添加填充。提防Radiogroup,因为如果它没有直接的孩子作为RadioButton,那么它的功能就会中断,并且您必须自己实现重新选择以前的按钮。
I've found the reason for such incorrect states of compound buttons. It's is because I've used an Inset to add left padding before the button like that:
I tried to find a way to add padding differently but I've ended up wrapping every button with additional FrameLayout and adding padding there. Watch out with RadioGroup because if it doesn't have a direct child as RadioButton then its functionality breaks and you have to implement reselecting previous buttons by yourself.