Android Question Customlistview endles scrollbar

JDS

Active Member
Licensed User
Longtime User
Hi all,

I've got a customlistview list with a single item. however when there is only one item the scrollbar is endless. If there're two (or more) items in the list there isn't a problem.

I've narrowed it down to the _visblerangechanged sub.

Any thoughts?

B4X:
Sub CustomListView1_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    Dim ExtraSize As Int = 15
    Dim su As StringUtils
    Dim text1 As String
    Dim cd2 As ColorDrawable
    cd2.Initialize(Colors.RGB(255,255,255),0dip)
    'we need to add the panel to a parent to set its dimensions. It will be removed after the layout is loaded.
    If Timer1.Interval>0 And Timer1.Enabled=False Then Return
    Log("MAX: "&Max(0, FirstIndex - ExtraSize))
    Log("MIN: "&Min(LastIndex + ExtraSize, CustomListView1.Size - 1))
    For i = Max(0, FirstIndex - ExtraSize) To Min(LastIndex + ExtraSize, CustomListView1.Size - 1)
        Dim p As Panel = CustomListView1.GetPanel(i)
        If p.NumberOfViews = 0 Then
            Dim cd As ZendingData = CustomListView1.GetValue(i)
            '**************** this code is similar to the code in CreateItem from the original example
            p.LoadLayout("LM_TeBezorgenCell")
            text1 = cd.Text1 & CRLF & cd.Text2 & CRLF & cd.Text3
            p.Background = cd2
            oCLV_List.Text =text1
           
            p.Height=su.MeasureMultilineTextHeight(oCLV_List,text1)
            oCLV_List.Height=p.Height
            
            CustomListView1.ResizeItem(i,p.Height)
        End If
    Next

    CustomListView1.AsView.Visible = True
End Sub
 

JDS

Active Member
Licensed User
Longtime User
What exactly does it mean?
At the top there is one item.
And then you can scroll down endles. Have a look at the screenshots.
At the first screenshot you see 1 item in the list
The second screenshot shows that I've scrolled a bit
The third screenshot shows no item anymore but at the right you see a very small scrollbar.

1.png

2.png
 

Attachments

  • 3.png
    3.png
    21.5 KB · Views: 212
Upvote 0
Top