0
votes

I have vertical viewpager implemented and I have to detect left and right swipe on it, I have to implement some feature on left and right swipe

like in below image, I have vertical ViewPager on white background portion and one imageview (circle) at center in bottom bar, the viewpager is above the bottom bar and below the top bar.

Now when I swipe left or right from anywhere position of ViewPager the circle should also swipe left and right as well,

so I have implement onTouchListener for viewpager but the problem is both event goes override I got up, bottom , left and right swipe evenet in onTouchListener and for left and right swipe I have implement circle left and right movement and for up and down swipe event I set viewpager.setCurrentItem(pagenumber, true); but then image scrolling is not as default as viewpager's scroll and the circle have also little move left or right (I want circle not moving left or right when swipe up or down on viewpager)

is any solution or alternative for this issue ? I will give him 50 reputation who help me out completely.

enter image description here

1
can you share video of your issue for proper understanding?Nikhil Vadoliya

1 Answers

0
votes

First thing will be good to see yours full code, but... You will have one main layout where you have defined Vertical viewpager, then in viewpager layout you should have defined RelativeLayout in which you will have normal horizontal viewpager and that circle, so both will be positioned relatively, so circle will not move while you are swiping... This should give you efect of possible swiping vertically and horizontally inside and having circle outside every view of horizontal viewpager.

EDIT:

Now Im reading it again, I just cant understand it very well, but maybe you shouldnt detect left and right swipes but the views, when view changes and from it you can recognize if user swiped left or right