android - 滚动条在 WebView 的 <div> 中不可见

标签 android html webview

我有一个包含滚动部分的 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/

相关文章:

c# - 固定标题 GridView ASP.NET

html - 具有行和列跨度的 CSS 响应式网格

objective-c - NS按钮 : Action on Element within a Custom View

authentication - Web Google 身份验证 - 403 : disallowed_useragent exists? 的解决方法

android - 如何在 LinearLayoutManager 中重叠项目 - RecyclerView(如堆叠卡片)

java - 可以使用哪些不同类型的上下文来代替 Activity ?

html - CSS 网格 : Is it possible to change z-index by targeting specific grid-items created dynamically?

macos - os X 上的 Cocoa WebView 无需单击并按住鼠标左键即可触发鼠标悬停事件

android - 如何知道调用的content provider发生了变化

android - Instabug,如果没有互联网访问,是否可以停用摇动以获得反馈?