Android Question Scroll one position Customlistview

Discussion in 'Android Questions' started by MarcoRome, Apr 15, 2019.

  1. MarcoRome

    MarcoRome Expert Licensed User

    Hi All.
    I need to scroll one position only. If i scroll, positions are displayed ultil last, i need that when i run the scroll it simply stops at the next one, without shaking the others

    I tried with this code, but dont work
    Code:
    Sub clv_ScrollChanged (Offset As Int)
        
    Dim VisibleIndex As Int = clv.FirstVisibleIndex   
            clv.ScrollToItem(VisibleIndex + 
    1)
            
    Return
    End Sub
    Any solution ?
    Thank you
    Marco
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Not sure that I understand the question. You can use JumpToItem if you want to change the scroll position immediately.
     
    Edgardo Nakaya and MarcoRome like this.
  3. MarcoRome

    MarcoRome Expert Licensed User

    Resolverd:

    Code:
    Sub clv_ScrollChanged (Offset As Int)
        ScrollIndex = ScrollIndex + 
    1
        
    Dim MyIndex As Int = ScrollIndex 'ScrollIndex as a global int variable
        Sleep(300)
        
    If ScrollIndex <> MyIndex Then Return
        
    Dim VisibleIndex As Int = clv.FirstVisibleIndex
        
    Dim RawItem As CLVItem = clv.GetRawListItem(VisibleIndex)
        
    Dim CurrentOffset As Int = clv.sv.ScrollViewOffsetY
        
    If CurrentOffset - RawItem.Offset > RawItem.Size / 2 Then
            clv.ScrollToItem(VisibleIndex + 
    1)
        
    Else
            clv.ScrollToItem(VisibleIndex)
        
    End If
            
    End Sub
     
    José J. Aguilar likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice