在 webview 案例中暂时禁用 Swiperrefreshlayout

And*_* Sk 7 android webview swiperefreshlayout

我创建了一个 android 项目,其中我在 Swiperrefreshlayout 中包含一个 Webview(我使用它来重新加载 webview 内容),如下所示:

<?xml version="1.0" encoding="utf-8"?>


<android.support.v4.widget.SwipeRefreshLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/swiperefresh"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    

<WebView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webview"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

    

</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)

正如你在上面看到的 SwipeRefreshLayout 是 Webview 的父级。

这在大多数情况下都很有效,除了谷歌地图出现在设置为全屏的 webview 中的情况。

在这种特殊情况下,我无法用手指向下移动地图,因为 SwipeRefreshLayout 的向下滑动效果不允许我尝试重新加载页面。

所以我需要以某种方式停用该特定页面的 SwipeRefreshLayout。我尝试使用 mySwipeRefreshLayout.setEnabled(false) 没有成功,因为这也禁用了 webview,因为它是 SwipeRefreshLayout 的子项并且一切都卡住了。

有什么建议吗?