android - 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>
解决方案
当下拉 webView 时,在 Swipe Refresh 方法中调用 URL。
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
//Call your URL again here
}
});
推荐阅读
- html - 将外部 CSS 样式表与 Shopify 产品页面链接
- python - 如何在python中将输出转换为dict?
- laravel - Laravel webpack.mix:当scss翻译成css时出现字体导入字符串中的换行符
- javascript - LightningChartJs点系列在改变角度路线后消失
- reactjs - Shouldn't useContext() only be used for low frequent updates? (mobx-react-lite)
- laravel - Laravel 验证是否多次选择相同的项目
- html - 当容器溢出-y 为自动且容器未溢出时如何看不到背景
- hibernate - 如何在不先进行连接的情况下在多对多连接表中插入记录?
- azure - 与 azcopy sync 相比,使用 Azure 文件同步将本地数据迁移到 Azure 存储有哪些优势?
- c++ - 转换后获取新机器人的航向