【问题标题】:webview's iframe pull down refreshwebview的iframe下拉刷新
【发布时间】:2018-08-28 12:26:49
【问题描述】:

如何在 Android 中刷新 webview。里面有一个 webview iframe。 当我使用 NestedScrollView 时,它会无限滚动。 即使我正在检查 y 方向的滚动值,它总是给我 0 但实际上它的实际值不是 0。

布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/swipeContainer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <RelativeLayout
        android:id="@+id/nonVideoLayout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:windowSoftInputMode="adjustResize">

        <WebView
            android:id="@+id/home_activity_webView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:windowSoftInputMode="adjustResize"
            app:layout_constraintDimensionRatio="1" />

    </RelativeLayout>

</android.support.v4.widget.SwipeRefreshLayout>

【问题讨论】:

  • 您的嵌套滚动视图问题在此链接中描述stackoverflow.com/questions/37775213/…
  • 我知道这个问题及其原因,但我想知道如何解决这个问题。我阅读了很多帖子,但没有找到任何与我的问题相符的答案。

标签: android iframe android-webview swiperefreshlayout


【解决方案1】:

当下拉 webView 时,在 Swipe Refresh 方法中调用 URL。

      swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {

                //Call your URL again here

            }
        });

【讨论】:

  • 但是什么时候调用滑动刷新..因为我在 webview 中的 iframe 位于 0 以外的某个位置。所以当我在 iframe 中使用下拉事件并启动它时它会发生冲突刷卡刷新事件。所以我想知道如何限制 iframe 滚动和刷新事件之间的冲突。
猜你喜欢
  • 2019-12-30
  • 2020-12-02
  • 1970-01-01
  • 1970-01-01
  • 2017-07-28
  • 2011-09-29
  • 2021-09-04
  • 1970-01-01
  • 2015-08-26
相关资源
最近更新 更多