Android Question horizontal customlistview width resize issue

giggetto71

Active Member
Licensed User
Longtime User
Hi,
I am facing an issue with the horizontal custom list view. basically I am not able to resize the width at runtime. actually I can but when I add items, these are added up until the size the clv had before the runtime resize (i.e the designer size). the code below is quite simple and the intent is to resize at runtime the width of the clv and the clv gets actually resized but the items are visible only up to the orginal size and and the portion of width increased is left empty .Any idea?






B4X:
ub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
    Log(CLVH.AsView.Width)
    CLVH.AsView.Width = CLVH.AsView.Width * 1.5
    
    Private ii As Int
    For ii = 0 To 10
        
        CLVH.Add(CreateItemH(CLVH.AsView.Height,"",ii,""),"")
                
    Next
    
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    xui.MsgboxAsync("Hello world!", "B4X")
End Sub


Private Sub CreateItemH(Height As Int, Title As String, Item As String, Content As String) As Panel
    Dim p As B4XView = xui.CreatePanel("")
    Dim Width As Int = Height *0.5
        
    p.SetLayoutAnimated(0, 0, 0, Width, Height)
    p.LoadLayout("LH")   
    
    Return p
End Sub
 

giggetto71

Active Member
Licensed User
Longtime User
thanks for the quick reply.I tried but ResizeItem apparently resizes the width of the nth item. my goal is to change the width of the clv at runtime and increase it respect to its design width.
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
found it. what seems to do the trick is:

B4X:
CLVH.sv.Width = CLVH.AsView.Width *1.5
CLVH.AsView.Width = CLVH.AsView.Width *1.5
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…