Android Question CustomListView Moving Items

advansis

Active Member
Licensed User
Longtime User
Hi guys,
I use a CustomListView to display a list of items, filled by "AddTextItem" method (it represents a "TO DO" list).
It would be useful to move each item up or down to reflect a priority property.
Is there a way to "MOVE" items or, at least to swap two of them (both text and value properties) ?
Thanks in advance

PS. I tried deleting and inserting items, but the visual effect is very ugly...
 
Last edited:

LucaMs

Expert
Licensed User
Longtime User
Hi guys,
I use a CustomListView to display a list of items, filled by "AddTextItem" method (it represents a "TO DO" list).
It would be useful to move each item up or down to reflect a priority property.
Is there a way to "MOVE" items or, at least to swap two of them (both text and value properties) ?
Thanks in advance

PS. I tried deleting and inserting items, but the visual effect is very ugly...
You have to remove the item you want to move, recreate it and insert it in the new position.
(clv.RemoveAt - clv.InsertAt)
 
Upvote 0

mangojack

Well-Known Member
Licensed User
Longtime User
Remove and re-insert the item at desired position ..

clv.RemoveAt
clv.InsertAtTextItem
 
Upvote 0

advansis

Active Member
Licensed User
Longtime User
Thanks anyway...
... as I said:
I tried deleting and inserting items, but the visual effect is very ugly...
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Thanks anyway...
... as I said:
I tried deleting and inserting items, but the visual effect is very ugly...

(B4J)

1.gif
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Thanks anyway...
... as I said:
I tried deleting and inserting items, but the visual effect is very ugly...
What does it mean "Visual Effect Very Ugly"? And what would you like to obtain?
You could try
Disable XCLV Animation:
YourCLV.AnimationDuration = 0
In this way everything related to adding or removing items will happen instantly instead that with a short animation like now.
 
Upvote 0

advansis

Active Member
Licensed User
Longtime User
Thanks. I think AnimationDuration=0 will do the trick. For my personal knowledge, is there a way to change the Value member of an item ?
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
Thanks. I think AnimationDuration=0 will do the trick. For my personal knowledge, is there a way to change the Value member of an item ?
I think that the only way is to remove the item and recreate it in the same position changing the Value.
 
Upvote 0

Sagenut

Expert
Licensed User
Longtime User
... if you don't like the LucaMs's "solution" 😄

(I have to discover who is LucaMs 😂 )
It's not that I don't appreciate your work, absolutely.
It was just to talk about the standard XCLV usage.
But any good alternative is of course welcome!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User

clvdragger-gif.78844
 
Upvote 0
Top