SwitchButton
SwitchButton copied to clipboard
快速多次设置setChecked(true)之后的check状态就不准了
比如接连执行下面这两行代码,根据测试实际效果第一行设置开启,第二行却设置关闭了。。
switchButton.setChecked(true); switchButton.setChecked(true);
我也碰到了,是它动画没做完,然后有重复,最终结果出问题了。可以考虑设置动画时间非常短看看
我也遇到了,
嗯,如果是开启动画效果的话,在触发一次开关时,需要一段时间渲染动画,这期间是禁止了切换操作的发自我的iPhone------------------ 原始邮件 ------------------发件人: 沐尧 [email protected]发送时间: 2020年7月1日 10:16收件人: zcweng/SwitchButton [email protected]抄送: Subscribed [email protected]主题: 回复:[zcweng/SwitchButton] 快速多次设置setChecked(true)之后的check状态就不准了 (#16) 我也遇到了,
—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe. [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/zcweng/SwitchButton/issues/16#issuecomment-652145965", "url": "https://github.com/zcweng/SwitchButton/issues/16#issuecomment-652145965", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]
是啊,我发现了 0.3s 以内的问题,但是问题应该在于
if(isChecked()){ //切换到unchecked setUncheckViewState(afterState); }else{ setCheckedViewState(afterState); }
前后两次都是一样的,因为没有修改 afterState 如果我们直接把状态设置好,让动画强制执行就不会有这个问题了
昨天这个问题一直没找到 加班到2点,还好今天发现了
请问这个问题怎么修改呢?