iOS Question xCustomListView Horizontal - list can also be scrolled vertically

Alexander Stolte

Expert
Licensed User
Longtime User
I have set the xCustomListView to Horizontal, all anchor points go from left to right and from top to bottom on both sides. I now add items that are exactly the same size as the list itself. The problem is that although the list is exactly the same size as the listview, you can scroll it vertically. Why is that?

Example project is attached, what shows the problem.

It looks as if there is a gap at the bottom, but this cannot be the case.
 

Attachments

  • Test Project.zip
    159 KB · Views: 93

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is related to the safe area. Looks like iOS treats it as an inaccessible area and this causes this issue.

Check this code:
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private CustomListView1 As CustomListView
End Sub

Public Sub Initialize
    
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    #if B4A or B4J
    Root = Root1
    #else if B4i
    Root = xui.CreatePanel("")
    Root1.Color = xui.Color_White
    Root1.AddView(Root, 0, 0, Root1.Width, Root1.Height)
    #end if
    'load the layout
    Root.LoadLayout("frm_main")
    If Root.Width = 0 Then
        Wait For B4XPage_Resize (Width As Int, Height As Int)
        B4XPage_Resize(Width, Height)
    End If
    For i = 1 To 100
        Dim pnl As B4XView = xui.CreatePanel("")
        pnl.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, CustomListView1.AsView.Height)
        pnl.Color = Rnd(xui.Color_Black, xui.Color_White)
        CustomListView1.Add(pnl, "")
    Next
End Sub

Private Sub B4XPage_Resize (Width As Float, Height As Float)
    #if B4i
    Dim r As Rect = B4XPages.GetNativeParent(Me).SafeAreaInsets
    Root.SetLayoutAnimated(0, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
    #end if
End Sub
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
It is related to the safe area. Looks like iOS treats it as an inaccessible area and this causes this issue.
can the following be the solution?
 
Upvote 0
Top