Debtaru
Debtaru

Reputation: 43

Two finger swipe for Horizontal pager in Android

I am trying to implement two finger like swipe for HorizontalPager. I understand the single swipe feature of HorizontalPager which works fine. How to distinguish between a one finger swipe and two finger swipe? Can anyone tell me how to implement two finger swipe for HorizontalPager? A code sample would be more helpful.

Upvotes: 2

Views: 2410

Answers (1)

MRD
MRD

Reputation: 7184

Have a look to this answer:

https://stackoverflow.com/a/7840953/1026620

It should work if you override onTouchEvent in the View. With

event.getPointerCount()

check if it is equal to 2. In that case, change to the next page. Otherwise, ignore the gesture.

Upvotes: 1

Related Questions