OnCheckedChangeListener和setChecked之间冲突问题解决

判断是否点击!buttonView.isPressed()来解决

CompoundButton.OnCheckedChangeListener checkedChangeListener = new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            if (switchCheckedListener == null) {
                return;
            }
            if (!buttonView.isPressed()) {
                return;
            }
            switchCheckedListener.checked(isChecked);
        }
    };

posted @ 2018-06-30 21:43  西北野狼  阅读(880)  评论(0编辑  收藏  举报