WebView 的 iframe 下拉刷新



如何在Android中刷新Web视图。在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>

下拉 Web 视图时,请调用滑动刷新方法中的 URL。

swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//Call your URL again here
}
});

最新更新