2013-05-22 40 views
-1

誰能告訴我如何在CustomDialogDialogTheme活動中獲得一扔動作事件。我嘗試過implementing GestureDetector.OnGestureListener,但它甚至不認識觸摸。有什麼建議麼 ??一字排開內部對話框Android

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.. 
    } 
+0

請說明你做了什麼。 –

回答

0

您可能沒有在對話框內容視圖中設置setOnTouchListener。類似這樣的:

mGestureDetector = new GestureDetector(this, mGestureListener); 

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

     return mGestureDetector.onTouchEvent(event); 
    } 
});