Android Question xCustomListView item widths

Serge Bertet

Active Member
Licensed User
Hello,

This is beginner (as I am) question for sure.

I'm unable to fill a CLV entire width with added panels.
Here is a short code:

B4X:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("clv_test")        ' <--- xCLV only
    xCLV.sv.SetLayoutAnimated(0, 0dip, 0dip, 100%x, 100%y)   ' <-- wich one of these 2 should
    xCLV.GetBase.SetLayoutAnimated(0, 0dip, 0dip, 100%x, 100%y)   ' <-- be placed at first?
    For i = 1 To 10
        Dim p As Panel
        p.Initialize("pnl")
        p.SetLayout(0dip, 0dip, xCLV.sv.Width, 10%y)  ' <-- panels are only 30% of the CLV width ... why?
        p.Color = Colors.Blue
        xCLV.Add(p, 0)
    Next
End Sub

thx in advance.

Serge
 

Serge Bertet

Active Member
Licensed User
Is the answer too obvious to have a chance to get a post ... or ... too difficult?
My app is landscape only, if xCLV is less than 50%x then I can fill all lines with panels from begin to end.
I tried many things including:
B4X:
p.SetLayout(0dip, 0dip, 100%x, 10%y)
with no results. Actually I don't know if it is 100%x of the screen or of the parent (anyway I'll find it by tests).
Serge
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
Is the answer too obvious to have a chance to get a post ... or ... too difficult?
i think its because android is not easy to test and need some time.
if you would upload a exported project (or example project) to play with i guess u get more response here.
 
Last edited:
Upvote 0

Serge Bertet

Active Member
Licensed User
Thx Markus,
Added some sleep(10) and some deprecated DoEvents, nothing.
Tried also using XUI.createPanel like you, no way.
I was looking for an event after the SetLayoutAnimated to use a Wait For
My Android version is 4.2.1 (maybe too old)?
I attach this post a zip of a test app.
Serge
 

Attachments

  • CLV_test.zip
    10.1 KB · Views: 148
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
i edit it as example. u need correct setup of anchors in designer.
see also divider height at your clv its by default 2dip.
 

Attachments

  • CLV_test_new.zip
    10.2 KB · Views: 147
Last edited:
Upvote 0

Serge Bertet

Active Member
Licensed User
OK, that works!
Actually it was a matter of anchors.
The container and also its parent (a panel in my case) should be horizontally anchored ( <==> )
Thank you Markus for the help.

Serge
 
Upvote 0
Top