SwitchButton icon indicating copy to clipboard operation
SwitchButton copied to clipboard

快速多次设置setChecked(true)之后的check状态就不准了

Open bean-liu opened this issue 7 years ago • 6 comments

比如接连执行下面这两行代码,根据测试实际效果第一行设置开启,第二行却设置关闭了。。 switchButton.setChecked(true); switchButton.setChecked(true);

bean-liu avatar Jul 12 '17 08:07 bean-liu

我也碰到了,是它动画没做完,然后有重复,最终结果出问题了。可以考虑设置动画时间非常短看看

yytyxj avatar Jun 29 '18 02:06 yytyxj

我也遇到了,

XiaMuYao avatar Jul 01 '20 02:07 XiaMuYao

嗯,如果是开启动画效果的话,在触发一次开关时,需要一段时间渲染动画,这期间是禁止了切换操作的发自我的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" } } ]

zcweng avatar Jul 01 '20 03:07 zcweng

是啊,我发现了 0.3s 以内的问题,但是问题应该在于 if(isChecked()){ //切换到unchecked setUncheckViewState(afterState); }else{ setCheckedViewState(afterState); } 前后两次都是一样的,因为没有修改 afterState 如果我们直接把状态设置好,让动画强制执行就不会有这个问题了

XiaMuYao avatar Jul 01 '20 04:07 XiaMuYao

昨天这个问题一直没找到 加班到2点,还好今天发现了

XiaMuYao avatar Jul 01 '20 04:07 XiaMuYao

请问这个问题怎么修改呢?

threedeer avatar Jan 11 '21 09:01 threedeer