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
如题哦 将长按显示的view改为点击
The text was updated successfully, but these errors were encountered:
在原来MotionEvent.ACTION_DOWN 添加 一个新的变量赋值 mTime = System.currentTimeMillis();
将原来MotionEvent.ACTION_UP 中改为 if(System.currentTimeMillis() -mTime <300 &&x == event.getX()){ isLongPress = true; onLongPress(event); invalidate(); }else{ if (x == event.getX()) { if (isLongPress) { isLongPress = false; } } touch = false; invalidate(); }
Sorry, something went wrong.
还是有点问题 第一行应该改成: if(System.currentTimeMillis() -mTime < 300*1000 && Math.abs(event.getX() - x) < 50){
时间应该从毫秒算起,所以需要乘以1000,手指点击的时候从down到up多多少少会带一点偏移直,接x == event.getX() 限制的太死了,会导致误判,所以我判断移动区间小于50个像素。
No branches or pull requests
如题哦
将长按显示的view改为点击
The text was updated successfully, but these errors were encountered: