关于GestureDetector的onFling方法e1返回null问题
生活随笔
收集整理的這篇文章主要介紹了
关于GestureDetector的onFling方法e1返回null问题
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
解決辦法:
? 定義一個MotionEvent對象,在ondown里面賦值
?private MotionEvent mLastOnDownEvent = null;
? ? ? ?@Override
? ? ? ? public boolean onDown(MotionEvent arg0) {
? ? ? ? ?mLastOnDownEvent=arg0;
? ? ? ? ?return false;
? ? ? ?}
? ? ?@Override
? ? ?public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
? ? ? ? ?if(null==e1){
? ? ? ? ? ? e1 = mLastOnDownEvent;
? ? ? ? ? ? ? }
? ? ? ? ? if (e1==null || e2==null){
? ? ? ? ? ?return false;
? ? ? ? ?}
? ? ? }
?
轉(zhuǎn)載于:https://www.cnblogs.com/ethan-coder/p/3774750.html
總結(jié)
以上是生活随笔為你收集整理的关于GestureDetector的onFling方法e1返回null问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 为 Sublime Text 3059
- 下一篇: Editplus的正则表达式