Android Question Maximum scroll of a xCustomListView

angel_

Well-Known Member
Licensed User
Longtime User
How can I set the maximum scroll of a xCustomListView?, I'm trying this but it doesn't work how I want

B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
   
    Dim p0 As B4XView = xui.CreatePanel("")
    p0.SetLayoutAnimated(0, 0, 0, 100%x, 200%y)
   
    Dim p1 As B4XView = xui.CreatePanel("")
    p1.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
       
    Dim p2 As B4XView = xui.CreatePanel("")
    p2.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
   
    Dim p3 As B4XView = xui.CreatePanel("")
    p3.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
   
    Root.LoadLayout("LytTabMenu")
   
    p0.LoadLayout("LytASViewPager")
    clv1.Add(p0, "")
   
    TabStrip.Initialize(ASTabMenu1, ASViewPager1)

    p1.LoadLayout("Lyt1")
    p2.LoadLayout("Lyt2")
    p3.LoadLayout("Lyt3")
   
    TabStrip.AddPage(xui.Color_Blue, "AA", Null, Null, p1, 0)
    TabStrip.AddPage(xui.Color_Cyan, "BB", Null, Null, p2, 1)
    TabStrip.AddPage(xui.Color_Gray, "CC", Null, Null, p3, 2)
End Sub

Sub ASViewPager1_PageChanged(Index As Int)
    TabStrip.ViewPager_PageChanged(Index)
    MaxScroll(Index)
End Sub

Sub ASTabMenu1_TabClick(index As Int)
    TabStrip.TabMenu_TabClick(index)
End Sub

Sub MaxScroll(Indice As Int)
    Dim AltoScroll As Int  
    clv1.JumpToItem(0)
   
    Select Indice
        Case 0
            AltoScroll = 80%y
        Case 1
            AltoScroll = 100%y
        Case 2
            AltoScroll = 120%y
    End Select
   
    clv1.sv.Height = AltoScroll
End Sub
 

Attachments

  • B4AProject.zip
    93 KB · Views: 168

angel_

Well-Known Member
Licensed User
Longtime User
What does "maximum scroll" mean? Why add more items if you don't want the user to scroll to those items?
Each tab loads different controls (not the same as the example)

When loading the Tabs I set a height for the xCustomListView there are tabs where I load more controls than other tabs, so I don't need the xCustomListView to be that high, I wanted to limit that height for each tab (activity)
 
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
It doesn't work, I'm looking for something like:

B4X:
clv1.ResizeItem(0, NewHeight)

But without changing the size of the views
 

Attachments

  • B4AProject1.zip
    92.7 KB · Views: 179
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
I'm missing several libraries. Anyway, which views change their size? Are you talking about the animation?
When you select a tab it changes the size of the scroll (what I want) but it modifies the height of the views.

Maybe it's an incompatibility with the library

6jrro-sd07k.gif
 
Last edited:
Upvote 0

angel_

Well-Known Member
Licensed User
Longtime User
It looks like something with the custom container. You can try it with TabStripViewPager.
Thank you for your patience

I finally got what I wanted to do:

B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    'load the layout to Root
    
    Dim p0 As B4XView = xui.CreatePanel("")
    p0.SetLayoutAnimated(0, 0, 0, 100%x, 100%y)
    
    Root.LoadLayout("LytTabMenu")
    pnl0.LoadLayout("LytASViewPager")

    Dim p1 As B4XView = xui.CreatePanel("")        'Panel to load TabStrip
    Dim p11 As B4XView = xui.CreatePanel("")    'Temp panel with the activity
    p1.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p11.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p1.LoadLayout("LytClv1")    'Load CustomListView (clv) base
    p11.LoadLayout("Lyt1")        'Load activity
    clv1.Add(p11, "")            'Add activity to clv
    
    Dim p2 As B4XView = xui.CreatePanel("")
    Dim p22 As B4XView = xui.CreatePanel("")
    p2.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p22.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p2.LoadLayout("LytClv2")
    p22.LoadLayout("Lyt2")
    clv2.Add(p22, "")
    
    Dim p3 As B4XView = xui.CreatePanel("")
    Dim p33 As B4XView = xui.CreatePanel("")
    p3.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p33.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p3.LoadLayout("LytClv3")
    p33.LoadLayout("Lyt3")
    clv3.Add(p33, "")
    
    Dim p4 As B4XView = xui.CreatePanel("")
    Dim p44 As B4XView = xui.CreatePanel("")
    p4.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p44.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p4.LoadLayout("LytClv4")
    p44.LoadLayout("Lyt4")
    clv4.Add(p44, "")
    
    Dim p5 As B4XView = xui.CreatePanel("")
    Dim p55 As B4XView = xui.CreatePanel("")
    p5.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p55.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p5.LoadLayout("LytClv5")
    p55.LoadLayout("Lyt5")
    clv5.Add(p55, "")

    TabStrip.Initialize(ASTabMenu1, ASViewPager1)
    
    TabStrip.AddPage(xui.Color_Blue, "AA", Null, Null, p1, 0)
    TabStrip.AddPage(xui.Color_Cyan, "BB", Null, Null, p2, 1)
    TabStrip.AddPage(xui.Color_Gray, "CC", Null, Null, p3, 2)
    TabStrip.AddPage(xui.Color_Green, "DD", Null, Null, p4, 3)
    TabStrip.AddPage(xui.Color_Magenta, "EE", Null, Null, p5, 4)
    
    ResizeClv
    
    clv1.JumpToItem(ASViewPager1.CurrentIndex)
End Sub

Sub ASViewPager1_PageChanged(Index As Int)
    TabStrip.ViewPager_PageChanged(Index)
End Sub

Sub ASTabMenu1_TabClick(index As Int)
    TabStrip.TabMenu_TabClick(index)
End Sub

Sub ResizeClv
    clv1.ResizeItem(0, 50%y)
    clv2.ResizeItem(0, 70%y)
    clv3.ResizeItem(0, 90%y)
    clv4.ResizeItem(0, 110%y)
    clv5.ResizeItem(0, 130%y)
End Sub

Is it posible "compac" (do it in fewer lines) this?

B4X:
    Dim p1 As B4XView = xui.CreatePanel("")        'Panel to load TabStrip
    Dim p11 As B4XView = xui.CreatePanel("")    'Temp panel with the activity
    p1.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p11.SetLayoutAnimated(0, 0, 0, p0.Width, p0.Height)
    p1.LoadLayout("LytClv1")    'Load CustomListView (clv) base
    p11.LoadLayout("Lyt1")        'Load activity
    clv1.Add(p11, "")            'Add activity to clv
 

Attachments

  • B4AProject.zip
    98.1 KB · Views: 180
Upvote 0
Top