B4i Library [class] CustomListView

Erel

Administrator
Staff member
Licensed User


B4i implementation of CustomListView (http://www.basic4ppc.com/android/fo...xible-list-based-on-scrollview.19567/#content).

Note that you should make sure that there is a live reference to all instances of CustomListView. Otherwise the instance will be released and the events will not be raised.

You can use a global variable to store a live reference.

New version was uploaded. CustomListView is implemented as a custom view. It should be added with the designer.

V1.76 uploaded. This update brings the improvements added to B4A CustomListView:
- Animated inserts.
- ResizeItem method.
- FirstVisibleIndex / LastVisibleIndex properties.
- ScrollToItem.
- ReachEnd event.
- RemoveAt / ReplaceAt methods.

The class will be included as a library in B4i v4.30.
 

Attachments

Last edited:

hzchrisfang

Member
Licensed User
Hi, awesome Erel, could you please add longclick event into CustomListView ? And how to recognize swipe gestures ?
 
Last edited:

hzchrisfang

Member
Licensed User
I have add LongClick sub into my app. But when I take long press on my phone, it produce a multiple LongClick event response, how could this be?
 

stobi

New Member
Licensed User
Is the pull to refresh feature available in this B4I version ?
Also I'm Looking for a possibility to allow the User to reorder the list items. Is this possible?
 

stobi

New Member
Licensed User
As I'm new to B4I I don't think I'm able to implement this functionality ...
Will these features be available once the default iOS ListView will be implemented ?
 

Erel

Administrator
Staff member
Licensed User
Almost the same code as in B4A:
B4X:
Sub sv_ScrollChanged (OffsetX As Int, OffsetY As Int)
   If OffsetY + sv.Height >= sv.Panel.Height Then
     If DateTime.Now > lastAddItemsTime + 200 Then
       lastAddItemsTime = DateTime.Now
       CallSub(CallBack, EventName & "_AddItems")
     End If
   End If
End Sub
Add to Class_Globals:
B4X:
  Private lastAddItemsTime As Long
Main module:
B4X:
Sub clv1_AddItems
  Log("AddItems")
  For i = 1 To 20
  clv1.AddTextItem(i, i)
  Next
End Sub
 

Alberto Michelis

Well-Known Member
Licensed User
Hi, I have a customlistview and
1) when I add more lines than the screen height, I scrooll the list till the end, and, the last item is always showed at half its height.
How to solve this?
2) any way to sort the list by any of its line components?
How?

Thanks
 

ilan

Expert
Licensed User
CustomListView is implemented as a custom view. It should be added with the designer.
Does it means that we need to change old projects where we added the clv in our code and not via designer? (If we use the new class)
 
Top