Android Question Suggest ListView with selection

peacemaker

Expert
Licensed User
Longtime User
HI, All

Please, suggest a ListView class or lib (but not the mListView lib that is buggy), where selection is highlighted (or any way to show that tapped), SingleLine and TwoLine also.
Without extra features, just selection - CustomLIstView is too difficult, and it needs to have possibility to store many items, more than 3000.
 
Last edited:

Informatix

Expert
Licensed User
Longtime User
HI, All

Please, suggest a ListView class or lib (but not the mListView lib that is buggy), where selection is highlighted (or any way to show that tapped), SingleLine and TwoLine also.
Without extra features, just selection - CustomLIstView is too difficult, and it needs to have possibility to store many items, more than 3000.

The solution to most problems with listviews, including yours, is my UltimateListView but if you find CustomListView too difficult, then you should avoid my library. Since the two libs are very different, it is difficult to say whether one is easier to use than the other, but from my point of view CustomListView is not complicated at all; that's why I prefer to warn you.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
Thanks.

Seems, easiest way is to use
B4X:
Sub lst_Click(pnl As Panel, ID As Object)
pnl.Color = Colors.Red 'select tapped item
End Sub

with your CheckList class.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I found some code on the internet that works with a standard ListView, an example is attached. I use ListView's all the time with large lists >3000 items and I will find this one useful.

It uses StateListDrawable. Code is:

B4X:
    Dim CDPressed,CDNormal As ColorDrawable
    CDPressed.Initialize(Colors.Gray,0)  ' Normal color
    CDNormal.Initialize(Colors.Yellow,0) 'Selected color
 
    Dim SLD As StateListDrawable
    SLD.Initialize
    SLD.AddState(SLD.State_Pressed,CDPressed)
    SLD.AddState(-SLD.State_Pressed,CDNormal)
 
    Dim LVO As JavaObject = ListView1
    LVO.RunMethod("setSelector",Array As Object(SLD))
  
    ListView1.FastScrollEnabled=True

Requires the new JavaObject Library

I will post this in a new thread as well so anyone that needs it can find it.
 

Attachments

  • ListSelectColor.zip
    7.1 KB · Views: 245
Last edited:
Upvote 0
Top