Mario Muresean
Mario Muresean

Reputation: 273

How to stop slide in a certain point?

I have an horizontal list that when I slide it, it just goes to the final of the list or in the middle by that I mean that the slide it's not controlled.

What am I trying to do it's to control the slide that no matter how much the user slides it will go only to the next position.

As you can see in the image below that is the first element in the list and you can see the first element and the second a little, and what I want is that when the user slides to the next element it will show the same exact view like the first case, but in these case it will show the second element and part of third.

enter image description here

So what am I trying to get is to stop the slide in a certain position. Any help wouldd be appreciated.

Upvotes: 0

Views: 128

Answers (2)

Azim Salimov
Azim Salimov

Reputation: 375

You can use SnapHelper in order reach effect like ViewPager or use ViewPager2 itself. You can see more here

Upvotes: 1

Taranmeet Singh
Taranmeet Singh

Reputation: 1239

If you want the user to slide one item at a time then you should use ViewPager if you are using a HorizontalListView or a RecyclerView then the sliding would be free flowing.

You can check the docs for ViewPager here.

Upvotes: 0

Related Questions