-1

谁能告诉我如何在内部CustomDialogDialog Theme活动中获得运动事件。我试过了implementing GestureDetector.OnGestureListener,但它甚至不能识别触摸。有什么建议么 ??

GestureDetector.OnGestureListener, GestureDetector.OnDoubleTapListener {

    private GestureDetectorCompat mDetector;

    Override protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDetector = new GestureDetectorCompat(this, this);
    }


    @Override
    public boolean onFling(MotionEvent event1, MotionEvent event2, float velocityX, float velocityY) {
        // i want to detect this return true; } etc etc..
    }
4

1 回答 1

0

您可能尚未设置setOnTouchListener对话内容视图。像这样的东西:

mGestureDetector = new GestureDetector(this, mGestureListener);

yourDialogView.setOnTouchListener(new FrameLayout.OnTouchListener() {
     @Override
     public boolean onTouch(View v, MotionEvent event) {

        return mGestureDetector.onTouchEvent(event);
     }
});
于 2013-05-22T14:01:12.253 回答