0

ジェスチャ用のカスタム ビューを作成したい、自分で描画したい。

しかし、私はタッチイベントを取得していません。または、それらを取得していますが、GestureOverlayView は取得していません。

両方ともすべてのタッチイベントを取得できるようにしてください。

4

2 に答える 2

-1

このように onTouchEvent メソッドをオーバーライドできます

@Override
public boolean onTouchEvent(MotionEvent event) {
// Your code here
}
于 2012-11-02T12:49:25.563 に答える
-1

私が以前やっていたばかげた間違いをしている可能性があると思います。タッチ可能にしたいビューと並行して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>
于 2015-03-20T07:05:45.330 に答える