1

1)ビューがあり、2)ジェスチャ検出器があるLinearLayoutがあります。私の問題は、線形レイアウトでフリングジェスチャを実行したいときに、指がいずれかのビューに出くわすと、MotionEvent.ACTION_CANCELがスローされ、onFling()コールバックの起動が妨げられることです。

これらのフォアグラウンドビューはインテントを起動するためのナビゲーションの一部であるため、これらのフォアグラウンドビューのタッチを実際に無効にすることはできません。

Thx、-mL

4

2 に答える 2

0

おそらく、レイアウトのルート要素としてGestureOverlayViewがあるように聞こえませんか?

簡単な例:

<android.gesture.GestureOverlayView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/gestures"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"

    android:gestureStrokeType="multiple"
    android:eventsInterceptionEnabled="true"
    android:orientation="vertical">

    <ListView
        android:id="@android:id/list"  
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent"  />

</android.gesture.GestureOverlayView>

ここを参照してください:http: //developer.android.com/resources/articles/gestures.html

于 2012-05-08T18:52:25.163 に答える
0

ViewPagerの内部を見てみてください。 http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/android/support/v4/view/ViewPager.java#ViewPager.onInterceptTouchEvent%28android。 view.MotionEvent%29

(AndroidのLinearLayoutを拡張するだけで)LinearLayoutを作成し、onInterceptTouchEventをオーバーライドする必要があります。これは子の前に呼び出され、それが真の親を返す場合、子からタッチを盗みます。 http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent(android.view.MotionEvent

于 2012-05-08T18:57:56.190 に答える