Android ViewFlipper + Gesture Detector

I use a gesture detector to catch the “flings” and using the view flipper to change the screen when this happens. Some of my child's views contain listings. The gesture detector does not recognize swipe if you swipe the screen as a list. But it recognizes it if it is included in a TextView or ImageView. Is there a way to implement it so that it recognizes swipes, even if they are on top of another view that has ClickListener?

+3
source share
3 answers

Thanks for your reply. To make it work as I wanted it, I had to add the following:

myList.setOnTouchListener (gestureListener);

for each of my listings. Now they correctly recognize horizontal scrolls to change views and vertical movements to scroll through the list.

+5
source

An example from here: http://android-developers.blogspot.com/2009/10/gestures-on-android-16.html

<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>

I used this tutorial to look at a screen that says Android gesture. An example from which this comes from has a ListView using this GestureOverlayView to scroll through the list.

+4
source

Source: https://habr.com/ru/post/1738443/


All Articles