Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scroll-bar is not visible in <div> in WebView

I have Html File Containing a Scroll Division. When I add this HTML in WebView, it doesn't shows the scroll-bar for that div.

I have code in Html file.

// 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

When I add This Html file in WebView in xml File.

code of XMl is...

// some Html code

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

// some Html code

It Works fine but doesn't shows the Scroll-bar for that Div which was added in Html file

like image 498
Anil Jadhav Avatar asked Nov 03 '22 21:11

Anil Jadhav


1 Answers

Scrolling a div with overflow:auto is currently not available on the Android. But you can achieve the same with some work around using a combination of HTML, JavaScript, and CSS. See this link for the details.

Another solution is, you can use the iScroll library.

And for your information, here is a nice comparison of what may or may not and how work on various mobile browsers.

like image 84
Khan Avatar answered Nov 14 '22 23:11

Khan