Hi to all.
I am confused. Seeing that ListView is not recommended, i tried to use xCustomListView. But i see that, despite having loaded it, the type "xCustomListView" is not accepted, and even the example taken "as is" from this blog, uses CustomListView. Nevertheless it doesn't compile. Rather strange. Any idea? (see image)
Thanks.
Hi. Just added the reference to XUIViews library, without success,.. To be sincere, for my needs, the poor ListView could be enough. But it doesn't highlight the item when I tap on one of them in the List.. Thanks
The name of the lib. is xCustomListView, but the name of the view is just "CustomListview".
For historical reasons this was done, so it was possible to switch from the old "CustomListView" lib. to the better "xCustomListView" without having to place the view all over again in the designer.
Anyway, I got something working. I just need text lines in the CustomListView. Therefore I used AddTextLine, and works. What I don't like is the fact that the selection disappears quickly. I would like the selected line to stay visible (with another color). Is it possible? By the way, it is exactly the same problem of old ListView..
Hi. Finally I solved my issue. Don't know whether overkill or not. I write what I did, if anybody else meets this problem. Let's assume xcl=CustomListView
1) Used xcl.AddTextLine
2) Inside Xcl_ItemClick I used xcl.GetPanel on all items, putting them to default color
3) then I used xcl.GetPanel on the selected item, and put its color to the selected color.
Trivial. ok. Forgive me...
I was just testing my solution. With this piece of code the item colors are reversed that is black on white and white on blue.
B4X:
Private Sub clv1_ItemClick (Index As Int, Value As Object)
For i = 0 To clv1.Size - 1
clv1.GetPanel(i).Color = xui.Color_White
clv1.GetPanel(i).GetView(0).TextColor = Colors.Black
Next
clv1.GetPanel(Index).Color = Colors.blue
clv1.GetPanel(Index).GetView(0).TextColor = Colors.White
Log(Value)
End Sub