Android Question ExecuteHTML

AHilberink

Active Member
Licensed User
Longtime User
Hi,

I using DBUtils - Function ExecuteHTML.

This is part of the code:
B4X:
    Dim HtmlCSS As String
    HtmlCSS = "table {width: 100%;border: 1px solid #cef;text-align: left; }" _
        & " th { font-weight: bold;    background-color: #acf;    border-bottom: 1px solid #cef; }" _
        & "td,th {    padding: 4px 5px; }" _
        & ".odd {background-color: #def; } .odd td {border-bottom: 1px solid #cef; }" _
        & "a { text-decoration:none; color: #000;}"

And
B4X:
Sub ExecuteHtml(SQL As SQLCipher, Query As String, StringArgs() As String, Limit As Int, Clickable As Boolean) As String
    Dim Table As List
    Dim cur As Cursor
    If StringArgs <> Null Then
        cur = SQL.ExecQuery2(Query, StringArgs)
    Else
        cur = SQL.ExecQuery(Query)
    End If
    Log("ExecuteHtml: " & Query)
    If Limit > 0 Then Limit = Min(Limit, cur.RowCount) Else Limit = cur.RowCount
    Dim sb As StringBuilder
    sb.Initialize
    sb.Append("<html><body>").Append(CRLF)
    sb.Append("<style type='text/css'>").Append(HtmlCSS).Append("</style>").Append(CRLF)
    sb.Append("<table><tr>").Append(CRLF)
    For i = 0 To cur.ColumnCount - 1
        sb.Append("<th>").Append(cur.GetColumnName(i)).Append("</th>")
    Next
   
'    For i = 0 To cur.ColumnCount - 1
'        If i = 1 Then
'            sb.Append("<th style='width:200px;'>").Append(cur.GetColumnName(i)).Append("</th>")
'        Else
'            sb.Append("<th>").Append(cur.GetColumnName(i)).Append("</th>")
'        End If
'    Next
       
    sb.Append("</tr>").Append(CRLF)
    For row = 0 To Limit - 1
        cur.Position = row
        If row Mod 2 = 0 Then
            sb.Append("<tr>")
        Else
            sb.Append("<tr class='odd'>")
        End If
        For i = 0 To cur.ColumnCount - 1
            sb.Append("<td>")
            If Clickable Then
                sb.Append("<a href='http://").Append(i).Append(".")
                sb.Append(row)
                sb.Append(".com'>").Append(cur.GetString2(i)).Append("</a>")
            Else
                sb.Append(cur.GetString2(i))
            End If
            sb.Append("</td>")
        Next
        sb.Append("</tr>").Append(CRLF)
    Next
    cur.Close
    sb.Append("</table></body></html>")
    Return sb.ToString
End Sub

This standaard from the libary.

What I need is a Scrollbar at the table on more rows than my webview can handle. Is there a way, for example changing CSS or something?

Best regards,
André
 

Shahid Saeed

Active Member
Licensed User
Longtime User
The Webview has no scroll option. The webview is placed on a panel within a Scrollview. Could this be a problem?
By Default webview is scrollable, if the text length is more than the activity height it will scroll the view; Else it will not show the scrolls
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
By Default webview is scrollable, if the text length is more than the activity height it will scroll the view; Else it will not show the scrolls

Thanks, Shahid.

I just do:
B4X:
WebView1.LoadUrl("http://www.denetwerkadviseur.nl")

The website is higher than my WebView1.Height=340, but no scrolls.

What do I do wrong?

Best regards,
André
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
upload_2014-7-17_18-2-56.png


Make sure that there is no other view above the WebView.
 
Upvote 0

Shahid Saeed

Active Member
Licensed User
Longtime User
Which is the parent of your webview; Activity or Panel? If Activity is parent make sure the panel goes under webview. Webview should be on top in order to get touch gestures. It might be possible the panel or scroll view is above webview and that is why you are not able to scroll.
 
Upvote 0

AHilberink

Active Member
Licensed User
Longtime User
Which is the parent of your webview; Activity or Panel? If Activity is parent make sure the panel goes under webview. Webview should be on top in order to get touch gestures. It might be possible the panel or scroll view is above webview and that is why you are not able to scroll.

The Activity is the parent, but the layout with the WebView is loaded on a Scrollview panel and the ScrollView is loaded to a panel of AHViewPager like:
B4X:
                pan.LoadLayout("ScrollView")
                pi.LayoutLoaded = True
                ScrollView1.Panel.RemoveAllViews
                ScrollView1.Panel.Height=800dip
                ScrollView1.Panel.LoadLayout("Layout")
                Overzicht.LoadUrl("http://www.denetwerkadviseur.nl")

Isn't it possible to edit the CSS with code like Overflow:Auto? I am not familiar with CSS and I can't get it work. The CSS I am using is in the first post.

I hope that will be possible.

Best regards,
André
 
Upvote 0
Top