android - android WebView溢出:向上滚动时自动触发SwipeRefreshLayout
问题描述
当您使用 overflow:auto 加载 WebView 内容并且它被 SwipeRefreshLayout 包围时,向下滚动效果很好,但向上滚动会触发 SwipeRefreshLayout 的 onRefresh。
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
browser = findViewById(R.id.webview);
browser.loadUrl("https://odatv.com/mob.php"); //this is the url where the problem appears
}
在此站点中,问题仅出现在手机中,在平板电脑中运行正常。 视频演示 我扩展 WebView 以检查滚动位置,但未调用 onScrollChanged 并且仅在水平滚动时调用 onOverScrolled。
在这种情况下如何使 SwipeRefreshLayout 正常工作?
解决方案
推荐阅读
- python - 'tensorflow.python.framework.ops.EagerTensor' 对象没有属性 'conjugate'
- stm32 - 如何确定使用 FreeRTOS xTaskCreate 创建单个任务所需的 Stackdepth?
- csv - pyspark - 使用自定义行分隔符读取 csv
- uuid - 创建随机帖子 ID 而不是自动递增 - Strapi CMS
- javascript - 无法将日期格式(如 2021 年 10 月 12 日)转换为 Node、js 中的日期
- java - 限制数据库中具有某些值的行
- reactjs - 使用打字稿正确定义 RefObject
- javascript - 在 map 函数中从 Mongoose 获取文档会返回 Promise 待处理以及数据
- python - 使用python生成两个数字之间的n个数字列表
- python - 为什么是“@”和“。” 在“heykidhellogmail.com”中返回 True?