Android Question SD FlexGrid (Table) not scroll in scrollview

Star-Dust

Expert
Licensed User
Longtime User
FlexGrid is already a scrollView. Nesting multiple scrollviews is not a good solution. An event is absorbed by one scrollview and ignored by the others
 
Upvote 0

Blu Blu

Member
Licensed User
I'm sorry to respond this way, but I tried to upload the compressed file, and it's too large. Therefore, I will upload the .bal file and the code separately. I attempted to use the method you suggested, but in this case, the FlexGrid still doesn't scroll vertically.


B4X:
Sub Globals
    Private CustomListView1 As CustomListView
'    Private clvItem As CustomListView
    Private xui As XUI
    Private nested As CLVNested
    Private FlexGrid1 As FlexGrid
    Dim EV As Eval
    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    nested.Initialize(Activity)
    nested.base.LoadLayout("1")
    nested.CLV = CustomListView1
    
'    Dim p As B4XView = xui.CreatePanel("")
'    p.SetLayoutAnimated(0, 0, 0, 100%x, 200dip)
'    p.LoadLayout("Item")
'    p.Tag = FlexGrid1 'must set the Panel tag like this
'    CustomListView1.Add(p, "")
'    FillInnerList
    For i = 1 To 10
        CustomListView1.AddTextItem($"*** TITLE (${i}) ***"$, "")
        Dim p As B4XView = xui.CreatePanel("")
        p.SetLayoutAnimated(0, 0, 0, 100%x, 200dip)
        If i Mod 2 = 1 Then
            p.LoadLayout("Item")
            FillInnerList
        Else
            p.LoadLayout("ItemHorizontal")
            FillHorizontalInnerList
        End If
        p.Tag = FlexGrid1 'must set the Panel tag like this
        CustomListView1.Add(p, "")
    Next
End Sub

Sub FillInnerList
    EV.Initialize(FlexGrid1)
    FlexGrid1.ColsName=Array As String("aa", "bb","cc","X")
    FlexGrid1.ColsWidth=Array As Int(25%x,25%x,25%x,25%x)
    FlexGrid1.ColsType=Array As Int(FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeCheck)
    For i= 1 To 10
'        clvItem.AddTextItem($"Item #${x}"$, x)
        FlexGrid1.AddRow(Array As Object("AA"&i,"BB"&i,"CC"&i,False),True)
    Next
End Sub

Sub FillHorizontalInnerList
    EV.Initialize(FlexGrid1)
    FlexGrid1.ColsName=Array As String("dd", "ee","ff","X")
    FlexGrid1.ColsWidth=Array As Int(25%x,25%x,25%x,25%x)
    FlexGrid1.ColsType=Array As Int(FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeString,FlexGrid1.TypeCheck)
    For i= 1 To 10
'        clvItem.AddTextItem($"Item #${x}"$, x)
        FlexGrid1.AddRow(Array As Object("DD"&i,"EE"&i,"FF"&i,False),True)
    Next
End Sub
 

Attachments

  • 1.bal
    2 KB · Views: 76
  • item.bal
    2 KB · Views: 73
  • itemhorizontal.bal
    2 KB · Views: 76
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
As you read in Erel's post it is difficult to nest scrollview, you have unexpected results. Maybe you can find other solutions on the forum
 
Upvote 0

Blu Blu

Member
Licensed User
Thank you very much for your response. I think your suggestion is a good solution. However, based on the workflow of my software, I have decided to have the user click save, which will then open a page containing the FlexGrid where the user can interact with it. Thank youvery much again❤️
 
Upvote 0
Top