ジェスチャ用のカスタム ビューを作成したい、自分で描画したい。
しかし、私はタッチイベントを取得していません。または、それらを取得していますが、GestureOverlayView は取得していません。
両方ともすべてのタッチイベントを取得できるようにしてください。
このように onTouchEvent メソッドをオーバーライドできます
@Override
public boolean onTouchEvent(MotionEvent event) {
// Your code here
}
私が以前やっていたばかげた間違いをしている可能性があると思います。タッチ可能にしたいビューと並行してgestureOverlayViewを使用しないでください。ただし、それらのビューをgestureOverLayViewの子として使用してください。
してはいけないこと
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.gesture.GestureOverlayView
android:id="@+id/gOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:eventsInterceptionEnabled="true"
android:fadeOffset="1000"
android:gestureColor="@color/gesture_color"
android:gestureStrokeType="multiple"
android:uncertainGestureColor="@color/gesture_color" >
</android.gesture.GestureOverlayView>
<LinearLayout
android:id="@+id/customtab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3" >
</LinearLayout>
</RelativeLayout>
あなたがすべきこと..
<android.gesture.GestureOverlayView
android:id="@+id/gOverlay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:eventsInterceptionEnabled="true"
android:fadeOffset="1000"
android:gestureColor="@color/gesture_color"
android:gestureStrokeType="multiple"
android:uncertainGestureColor="@color/gesture_color" >
<LinearLayout
android:id="@+id/customtab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3" >
</LinearLayout>
</android.gesture.GestureOverlayView>