我有一个包含滚动部分的 Html 文件。当我在 WebView 中添加此 HTML 时,它不显示该 div 的滚动条。
我在 Html 文件中有代码。
// some Html code
<table style="border: 3px solid black;" align="center">
<tr>
<td ><div style="width: 100%; height: 50px; overflow: auto; padding:0px; "> <div>
put returns between paragraphs
► for linebreak add 2 spaces at end
► _italic_ or **bold**
► indent code by 4 spaces
► backtick escapes `like _so_`
► quote by placing > at start of line
► to make links
<http://foo.com>
[foo](http://foo.com)
► basic HTML also allowed
</div></td>
</tr>
</table>
// some Html code
当我在 xml 文件中的 WebView 中添加 This Html 文件时。
XMl 的代码是...
//一些Html代码
<RelativeLayout
android:id="@+id/webLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/buttonLayout"
android:layout_below="@+id/titleLayout" >
<WebView
android:id="@+id/webViewMain"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</WebView>
</RelativeLayout>
//一些Html代码
它工作正常但不显示在 Html 文件中添加的那个 Div 的滚动条
最佳答案
使用 overflow:auto
滚动 div 目前在 Android 上不可用。
但是您可以通过结合使用 HTML、JavaScript 和 CSS 来实现相同的效果。参见 this详情链接。
另一种解决方案是,您可以使用 iScroll图书馆。
为了您的信息,here is a nice comparison of what may or may not and how work on various mobile browsers .
关于android - 滚动条在 WebView 的 <div> 中不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11220264/