不能刷新网络视图?[英] can't swipe webview?

本文是小编为大家收集整理的关于不能刷新网络视图?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在尝试刷卡,如列表视图滑动....从左到右.我遵循了显示这里.

还在viewflipper

中设置了webviews
<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>

但我认为webview的onTouchEvent在这里不起作用.

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

推荐答案

尝试将两个webviews从LinearLayout中移动. ViewFlipper在其子项之间切换,并使用您的Setup 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">
    <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>

本文地址:https://www.itbaoku.cn/post/102491.html

问题描述

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

推荐答案

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>