android - WebView 在 API 30 中不滚动
问题描述
我在 WebView 中有一个 html 文件,它只包含文本。它不是滚动 API 30 设备(模拟器)。但它正在滚动 api 30 以下的其他设备。
xml:
<WebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" i tried match_parent and 0dp
app:layout_constrainedHeight="true"
android:layout_marginStart="@dimen/_20sdp"
android:layout_marginTop="@dimen/_20sdp"
android:layout_marginEnd="@dimen/_20sdp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/divider" />
我也试过:
android:scrollbars="vertical" (xml)
webView.isVerticalScrollBarEnabled = true (programatic)
并尝试使用 FrameLayout 或 ScrollView,但仍然无法正常工作。顺便说一下,我加载了一个资产文件:
webView.loadUrl("file:///android_asset/Agreement.html")
这是html文件的示例结构:
<html>
<head>
<title>Agreement</title>
</head>
<body>
<p>some texts... with <i> tag sometimes.... there are 2 paragraph </p>
</html>
解决方案
推荐阅读
- bigdata - 数据归档与数据摄取
- regex - 从字符串中的第二个括号中提取值
- mysql - 更新查询中的增量在表中添加 2 而不是 1
- android - 离子原生插件升级到 WKWebView 后停止工作
- javascript - 如何使用 ReactNative WebView 组件在我的 Android 应用程序中显示网页的特定部分?
- c# - 如何在c#中使用restclient处理嵌套查询
- powershell - 在 PowerShell 中添加对象属性的值,而无需按名称访问每个属性
- java - 在java中读取和写入文件
- asp.net-mvc - UnauthorizedAccessException 使用需要访问令牌的 API
- c# - 如何简化下面的 LookUp 命令?