Tal Hindi
Tal Hindi

Reputation: 245

Drag views freely in ScrollView android

I have been looking for a solution for this for a while now, What I'm trying to do is an application with drag animation like Tinder, the difference is that I have 3 images at once, one below the other and all of them are in ScrollView. My problem is that when I'm touching to move it up and down the ScrollView takes place, I can move it freely left and right but if I move it up/down even by one pixel I lose it. I've tried to make custom ScrollView that disables the touch of it when I touch the other View's with no luck :(, I thought maybe try and make the views that I want to drag to be at the top of the views with the Z-index and I couldn't find anything about it. I saw some answers like the dispatchTouchEvent and intercepTouch or something like this but I didnt understant how to work with it.

Sorry for my English, Thank you!

Upvotes: 1

Views: 1101

Answers (1)

Tal Hindi
Tal Hindi

Reputation: 245

Found the answer, I used getParent of the view until I get to the scrollview as parent, and used requestDisallowInterceptTouchEvent(true) that solved it!

Upvotes: 1

Related Questions