2

リストビューのスワイプのようにWebビューをスワイプしようとしています....左から右へ。ここに示した方法に従いました。

また、私webviewsviewflipper

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

onTouchEventしかし、ここでは webView が機能しないと思います。

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

1 に答える 1

1

LinearLayout から 2 つの WebView を移動してみてください。ViewFlipper はその子を切り替えます。セットアップでは、ViewFlipper には子が 1 つしかありません。これを試して:

<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>
于 2010-10-09T21:37:37.817 に答える