Android Question Bug using Scroll View with panel and label

Luiz Fernando Orlandini

Active Member
Licensed User
Longtime User
Hi All,

I'm using a scroll view to implement a query in database im my APP.

Unfortunately the app's behavior looks strange. After adding some labels in the panel, the labels was set, but the text is not visible in my APP.

The attached images can show these.

Screenshot_2014-07-14-23-22-11.png Screenshot_2014-07-14-23-22-08.png

The code:

B4X:
Sub ProcessCursor
    messages = CallSub(MessageService, "GetMessages")

    Dim Panel0 As Panel
    Dim PanelTop, PanelHeight As Int
   
    Panel0.Initialize("")
   
    PanelTop = 0
    Panel0.Color = Colors.Transparent

    SV.Panel.AddView(Panel0, 5dip, 5dip, SV.Width-10dip, SV.Height-10dip)
    SV.FullScroll(True)

    For i = 0 To messages.RowCount - 1
        messages.Position = i

        Dim Label2 As Label
        Label2.Initialize("")
        Panel0.AddView(Label2, 0, PanelTop, SV.Width, PanelHeight)

        Label2.Color = Colors.Transparent
        Label2.TextColor = Colors.Black
        Label2.TextSize = 18
        Label2.Text = "Mensagem #"& (messages.RowCount - i) & CRLF & messages.GetString("message")
       
        Log(Label2.Text)
       
        Dim str As StringUtils
        Dim h As Int = str.MeasureMultilineTextHeight(Label2, Label2.Text)
        PanelHeight = h
       
        Label2.Height = h
        PanelTop = PanelTop + PanelHeight + 10dip
        SV.Panel.Height = PanelTop
    Next
End Sub

B4X:
Sub GetMessages As Cursor
    Return data.ExecQuery("SELECT id, message FROM messages")
End Sub

Can anybody help to solve this issue? I just need all my record to be shown in my APP.
 
Top