0

I have an Activity in my app where I want to detect drag gestures. So I implemented the boolean onTouchEvent(MotionEvent event) function and can now handle a drag-gesture.

The only problem I have right now is that I only get the onTouchEvent called when I drag on the background view where there is nothing on top of it.

The problem is that I now also have a container-view inside my activity and I also want to recognise the drag if the user starts dragging inside this container. This container also contains buttons that still need to work...

Any idea on how to implement that or what I am missing?

Georg
  • 3,664
  • 3
  • 34
  • 75

1 Answers1

0

You need to add this to your top level container in the xml, i.e, the parent view of all these views:

android:descendantFocusability="blocksDescendants"
Prateek
  • 1,062
  • 1
  • 10
  • 27
  • I just tried adding that to the top-level `RelativeLayout` but that didn't change anything...?!? – Georg Feb 27 '15 at 12:08