Do not touch, but in general terms, handle the finger event, the finger move event, and the finger event. Calculate the speed on the display (distance / time - this can be done in units of absolute distance or in pixels). During a finger move event, scroll through the contents in step from the delta distance. After the finger event, quickly reduce the calculated speed and continue moving along the screen along the same axis as before the finger event. The degradation function is probably not linear for a more realistic effect. In addition, there should probably be an initial half-distribution of the estimated speed, otherwise you will end the menu scroll too far. Play with numbers and you will find a sweet spot.
source share