Android Code Snippet UltimateListView (ULV) - smooth scroll for PlaceItemFromTop

If you're using ULV's placeItemFromTop function, and you want the smooth-scroll option that other functions offer (e.g. JumpTo), here's the code to do it using JavaObject, based on a suggestion from ULV's creator, @Informatix :

B4X:
'scroll the ULV to the given position, offset from the top, with duration in milliseconds.
'same as ULV.placeItemFromTop, but with smooth scrolling and control over duration
Sub placeUlVItemFromTopSmoothly(ulvArg As UltimateListView, positionArg As Int, offsetArg As Int, durationArg As Int)
    Dim ulvJO As JavaObject = ulvArg
    ulvJO.RunMethod("smoothScrollToPositionFromTop", Array As Object(positionArg, offsetArg, durationArg))
End Sub

Hope this helps!
 
Top