views:

49

answers:

1

I'm trying to get swipe the Web Views like list view swipe.... from left to right. I've followed the way that showed here.

Also I've set the webviews in the viewflipper

<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/flipper" android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <LinearLayout>
        <WebView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/webview1" android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
        <WebView xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/webview2" android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>

but I think the onTouchEvent of webView does not work here.

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (gestureDetector.onTouchEvent(event))
            return true;
        else
            return false;
    }
A: 

Try moving your two WebViews out of your LinearLayout. ViewFlipper switches between its children, and with your setup ViewFlipper has only one child. Try this:

<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper" android:layout_width="fill_parent"
android:layout_height="fill_parent">
    <WebView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview1" android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
    <WebView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/webview2" android:layout_width="fill_parent"
        android:layout_height="fill_parent" />
</ViewFlipper>
connorb3