We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
看了一下代码在move里面没有加边界判断,超出控件自身范围后,应该和UP里面的执行一样的逻辑吧
switch (action) { case MotionEvent.ACTION_DOWN: catchView(); mStartX = event.getX(); mStartY = event.getY(); mLastX = mStartX; setPressed(true); break; case MotionEvent.ACTION_MOVE: float x = event.getX(); setProcess(getProcess() + (x - mLastX) / mSafeRectF.width()); mLastX = x; break; case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: setPressed(false); nextStatus = getStatusBasedOnPos(); float time = event.getEventTime() - event.getDownTime(); if (deltaX < mTouchSlop && deltaY < mTouchSlop && time < mClickTimeout) { performClick(); } else { if (nextStatus != isChecked()) { playSoundEffect(SoundEffectConstants.CLICK); setChecked(nextStatus); } else { animateToState(nextStatus); } } break; default: break; }
The text was updated successfully, but these errors were encountered:
这是Android事件机制决定的,同时由于SwitchButton自身比较小,这个特性也使得使用者误操作的几率大大降低。也建议你尝试一下原生的Switch,以及其他应用的做法。
Sorry, something went wrong.
No branches or pull requests
看了一下代码在move里面没有加边界判断,超出控件自身范围后,应该和UP里面的执行一样的逻辑吧
The text was updated successfully, but these errors were encountered: