I'm using this code for the swipe, onTouch event in android
<ViewFlipper
android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/tabBTBar" >
<LinearLayout
android:id="@+id/first"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/cat_listLV"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="@color/grey"
android:dividerHeight="1dp" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="@+id/Second"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#C0C0C0"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_launcher" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/ic_launcher" />
</LinearLayout>
</ViewFlipper>
It display only listview which is in first LinerLayout when i'm run this code.
and it will work fine when i'm using the instead of in the first Linearlayout.
Please suggest me how i can do this. I want to display Listview in both LinearLayout.. in first and second.
add this method in your java file.
@Override
public boolean dispatchTouchEvent(MotionEvent motionEvent) {
super.dispatchTouchEvent(motionEvent);
return gestureDetector.onTouchEvent(motionEvent);
}
instead of using the onTouchEvent() method