在WebView </div>中的<div>中看不到滚动条

时间:2012-06-27 06:00:02

标签: 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

当我在WebView的xml文件中添加此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的滚动条

1 个答案:

答案 0 :(得分:2)

使用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

相关问题