In my android-app I have a Layout consisting of a FrameLayout
containing a GridView
.
Each grid cell consists of one RelativeLayout
with a TextView
and a ListView
within.
Now I tried to swipe right and left. For this, I implemented an OnSwipeTouchListener
based on the SO-Question here and added it to the FrameLayout
.
Now, everything works fine. Except if I want to swipe over a ListView
. If I swipe on a ListView
the app doesn't do anything. I think it's because the ListView
captures somehow the TouchEvents itself, without letting my Activity know that there was a TouchEvent at all.
My layout is the following:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.Test"
android:id="@+id/frameLayout">
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="16"
android:rowCount="8"
android:id="@+id/grid">
<RelativeLayout
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/ll3"
android:layout_row="2"
android:layout_column="1"
android:orientation="horizontal" >
<TextView
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Montag"
android:textSize="40px"
android:background="#66ff66"
android:textStyle="bold"
android:layout_height="55px"
android:id="@+id/tv1"
android:layout_width="match_parent" />
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff"
android:layout_below="@+id/tv1"
android:id="@+id/l1">
</ListView>
</RelativeLayout>
</GridLayout>
</FrameLayout>
I set the OnSwipeTouchListener like this:
frameLayout.setOnTouchListener(new OnSwipeTouchListener(this));
I think I'm missing something on the ListView
-Side, something like disabling touch on a ListView at all.
Has anyone had this problem too or knows a Solution for this?