Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我使用 MotionEvent 使 SimpleOnGestureListener 捕获 onLongPress,但问题是我无法读取事件位移,因为我总是收到 ACTION_DOWN 代码。如何做到这一点?我想在长按时移动一些视图。 谢谢!
使用我的水晶球并且没有看到您的代码,我只能说您应该捕获 onTouch 事件。作为解决方案之一,您可以通过 onLongPress 设置一些布尔值(例如 PRESSED),然后在 onTouch 事件中处理移动事件。
或者您可以尝试与听众一起玩(设置和取消设置它们),但我认为这不是一个好主意。