views:

2086

answers:

2

I am using gesture detector to catch "flings" and using a view flipper to change the screen when this happens. Some of my child views contain list views. The the gesture detector wont recognize a swipe if you swipe on the list view. But it will recognize it if it is onTop of TextView's or ImageView's. Is there a way to implement it so that it will recognize the swipes even if they are on top of another view that has a ClickListener?

A: 

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 Android's gesture overlay view. The example which this comes from has a ListView utilizing this GestureOverlayView to scroll the list.

Adam
A: 

Thank you for your answer. In order to get it working how I wanted it to all I had to add was this:

myList.setOnTouchListener(gestureListener);

for each of my lists. Now they correctly recognize horizontal swipes to change views, and vertical movement for scrolling the list.

Tim