Android Question xCustomListView item panels

LucaMs

Expert
Licensed User
Longtime User
When I create a "b4xview panel" with rounded corners, it is ok if added directly to an Activity; if I pass (add) it to a xCustomListView, the corners are wrong:

1b.jpg
 

Attachments

  • xCLV test.zip
    13.9 KB · Views: 216

Erel

B4X founder
Staff member
Licensed User
Longtime User
Why aren't you using xCustomListView library?

Complete code:
B4X:
Sub Process_Globals
   Private xui As XUI
End Sub

Sub Globals
   Private CustomListView1 As CustomListView
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("layMain")
   For i = 1 To 20
       Dim p As B4XView = xui.CreatePanel("")
       p.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, 60dip)
       p.LoadLayout("Item")
       CustomListView1.Add(p, "")
   Next
End Sub

SS-2019-01-06_10.49.53.png
 

Attachments

  • xCLV test.zip
    9.8 KB · Views: 229
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
There is no background at all in the example I've posted. You are seeing the activity gradient background.
ah, yes, now I saw.
Well, by loading the layout it works well; by code not and I don't understand the reason.

Thanks, Erel.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Use the designer. It will be simpler.
Usually I use the layouts; this time I needed to do it by code, because an our friend prefers to do all by code ;)


The reason is that the item's base panel needs to be transparent. The inner panel can have round corners.
It's not clear for me, Erel, sorry :(.

Is it impossible to create that "kind of panel" (transparent) by code and add it to the xCLV?

Which inner panel do you refer to?

In short, the only solution is to use the Designer?
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
In short, the only solution is to use the Designer?
No.

Same layout without designer:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("layMain")
   For i = 1 To 20
       Dim p As B4XView = xui.CreatePanel("")
       p.SetLayoutAnimated(0, 0, 0, CustomListView1.AsView.Width, 60dip)
       Dim pp As B4XView = xui.CreatePanel("")
       pp.SetColorAndBorder(xui.Color_Blue, 2dip, xui.Color_White, 5dip)
       p.AddView(pp, 0, 0, p.Width, p.Height)
       CustomListView1.Add(p, "")
   Next
End Sub
Make sure to set the divider color to transparent.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I tried also:

B4X:
    xCLVV.GetBase.Color = xui.Color_Transparent
    Dim sv As ScrollView = xCLVV.GetBase.GetView(0)
    sv.Color = Colors.Transparent ' xui.Color_Transparent
    sv.Panel.Color = Colors.Transparent 'xui.Color_Transparent

(where xCLVV is a xCV of course) without success.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Change the custom view background alpha level to 0.
Dim b As B4XView = xCLVV.AsView
b.Color = Colors.ARGB(0,0,0,0)

Now it is perfect; now I just have to sleep, wake up and understand everything :D

Thank you, Erel
 
Upvote 0
Top