Hi everyone,
Im trying to do a Infinity scroll CLV.
tried almost every example of how to hide items off screen and load the visible ones, but a rare behavior came when scrolling:
Some items visible disappear on scroll, the logs catches weird hide and show items order:
		
		
	
	
		 
	
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
Im not using PCLV because i add dynamically more items on scroll from server, PCLV ignores new added items.
I cant get rid of this ¿bug?
I also notice lag when items are removed
I appreciate your help, i have weeks trying to solve this.
Example is attached
			
			Im trying to do a Infinity scroll CLV.
tried almost every example of how to hide items off screen and load the visible ones, but a rare behavior came when scrolling:
Some items visible disappear on scroll, the logs catches weird hide and show items order:
			
				B4X:
			
		
		
		Sub ServicesLV_VisibleRangeChanged (FirstIndex As Int, LastIndex As Int)
    Dim ExtraSize As Int = 15
    For i = 0 To ServicesLV.Size - 1
        Dim p As Panel = ServicesLV.GetPanel(i)
   
        If i > FirstIndex - ExtraSize And i < LastIndex + ExtraSize Then
       
            'Visible items Show
            If p.NumberOfViews = 0 Then
                Log("add lv item "& i)
           
                Dim data() As String = ServicesLV.GetValue(i)
                If Not( data(0).Contains("panel") ) Then
                    p.LoadLayout("item")
                    Try
                        'Load pub Left
                        PriceTag1.Text="$ 100"
                        PubLabel2.Text="Item 1"
                        PubImg1.Bitmap=LoadBitmapResize(File.DirAssets, "sample1.webp",200dip,200dip,True)
                        'Load pub Right
                        PriceTag2.Text="$ 100"
                        PubLabel2.Text="Item 2"
                        PubImg2.Bitmap=LoadBitmapResize(File.DirAssets, "sample2.webp",200dip,200dip,True)
                    Catch
                        Log(LastException)
                    End Try
                Else
                    Log("its a panel")
                End If
            Else
                'Not Visible items, hide
                If p.NumberOfViews > 0 Then
                    LogColor("remove lv index "& i,Colors.Yellow)
                    p.RemoveAllViews
                End If
            End If
        End If
    Next
End SubIm not using PCLV because i add dynamically more items on scroll from server, PCLV ignores new added items.
I cant get rid of this ¿bug?
I also notice lag when items are removed
I appreciate your help, i have weeks trying to solve this.
Example is attached
Attachments
			
				Last edited: 
			
		
	
								
								
									
	
		
			
		
	
								
							
							 
				 
 
		 
 
		 
 
		 
 
		 
 
		