简体   繁体   中英

How to set a final scroll's position in listView?

Maybe someone faced such a problem: I have adapter class, customView class. Everything works normal. But: When I scroll listView, It's possible to stop the scroll anywhere in the middle. But I expected: a final scroll's position (when soon as user's finger is up and inertia-movement is completed) should always be like on my screenshot(image1) and never like this(image2). 图片1 图片2

I hope I understood your question right.

To achieve this in ListView Android ListView - stop scrolling at 'whole' row position

For RecyclerView You can achieve this by using SnapHelper

LinearSnapHelper().attachToRecyclerView(recyclerView)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM