我希望我的 tablerow 对 Android 中的 OnSwipe-touch 敏感,但它对 onClick 太敏感
我想让我的 tableRow 监听 OnSwipe,然后显示删除按钮。我添加了一个手势检测器,当我滑动时它会显示按钮。但由于我还有一个 onClick 侦听器,因此 onclick 始终会触发并使用户离开活动。
我尝试禁用 OnClick 侦听器,但这并没有什么区别。 我还希望按钮即使在滑动后也保持可见,因为它现在在滑动完成后消失。
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
try {
if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
return false;
// right to left swipe
tr.setEnabled(false);
btnDelete.setVisibility(View.VISIBLE);
}
谢谢!
I want to make my tableRow listen to OnSwipe, and then show a delete-button. I have added a gesturedetector and it shows the button when I swipe. But since I also have a onClick-listener, the onclick always fires and makes the user leave the activity.
I have tried to disable the OnClick-listener, but that didn't make a difference.
I also want the button to stay visible even after the swipe, as it is now is goes away after the swipe is finished.
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY) {
try {
if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
return false;
// right to left swipe
tr.setEnabled(false);
btnDelete.setVisibility(View.VISIBLE);
}
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论