For i = 1 To 10
CustomListView1.AddTextItem("item " & i, i)
CustomListView1.GetRawListItem(CustomListView1.Size - 1).Panel.As(B4XView).SetColorAndBorder(xui.Color_White, 1dip, xui.Color_Black, 10dip)
Next
For i = 1 To 10
CustomListView1.AddTextItem("item " & i, i)
CustomListView1.GetRawListItem(CustomListView1.Size - 1).Panel.As(B4XView).SetColorAndBorder(xui.Color_White, 1dip, xui.Color_Black, 10dip)
Next
I have been struggling with layout / add panel to achieve similar objective, keeping in mind :AddTextItem can not do this, as Erel as advised many times.
Now you all are giving simple solution for it, in :AddTextItem itself !
I think what is confusing about calling it AddTextItem is the word ‘Text’. When you see ‘Text’, you think it is limited in scope. I would have called it AddImplicitItem or AddImplicitPanel. Everything related to xClv involves panels.
I think what is confusing about calling it AddTextItem is the word ‘Text’. When you see ‘Text’, you think it is limited in scope. I would have called it AddImplicitItem or AddImplicitPanel. Everything related to xClv involves panels.
It seems clear to me: Add allows you to add an Item consisting of a panel containing any number of views, AddItemText adds a "pre-packaged" Item, consisting of a panel and a label.
It seems clear to me: Add allows you to add an Item consisting of a panel containing any number of views, AddItemText adds a "pre-packaged" Item, consisting of a panel and a label.
Dim ItemsColor(2) As Int = Array As Int(xui.Color_Yellow, xui.Color_Blue)
For i = 1 To 10
CustomListView1.AddTextItem("item " & i, i)
Dim Item As CLVItem = CustomListView1.GetRawListItem(CustomListView1.Size - 1)
Item.Panel.SetColorAndBorder(ItemsColor(i Mod 2), 1dip, xui.Color_Black, 10dip)
Dim bxTextView As B4XView = Item.Panel.GetView(0).GetView(0)
bxTextView.TextColor = ItemsColor((i + 1) Mod 2)
Next
Dim ItemsColor(2) As Int = Array As Int(xui.Color_Yellow, xui.Color_Blue)
For i = 1 To 10
CustomListView1.AddTextItem("item " & i, i)
Dim Item As CLVItem = CustomListView1.GetRawListItem(CustomListView1.Size - 1)
Item.Panel.SetColorAndBorder(ItemsColor(i Mod 2), 1dip, xui.Color_Black, 10dip)
Dim bxTextView As B4XView = Item.Panel.GetView(0).GetView(0)
bxTextView.TextColor = ItemsColor((i + 1) Mod 2)
Next
Strange thing: the above line works in B4A, not in B4J.
This is because you have to specify Array As Int(...) in B4J (Array(...) by default is an array of objects).
I don't know why (Erel )
For i = 0 To clv1.Size -1
Dim item As CLVItem = clv1.GetRawListItem(i)
item.Panel.SetColorAndBorder(xui.Color_White, 2dip, xui.Color_DarkGray, 6dip)
Dim lbl As B4XView = item.Panel.GetView(0).GetView(0)
lbl.As(Label).Padding = Array As Int (5dip, 5dip, 5dip, 5dip)
Next
I think AddTextItem sets the height equal for all items, based on the xCLV TextSize set in the Designer and on a single line of text.
I don't think you can change the height of these items at runtime; in this case, it is better to use Add and create custom items.