1

I want to add an image from gallery in my constraint Layout and a touch event for the image.

I could do this, but when adding two images, touch event only works on the last image.

my touch events are: move-resize-rotate

tomerpacific
  • 4,704
  • 13
  • 34
  • 52

1 Answers1

0

You can not have touch event for the underneath layers when some view on the top is consuming your touches. In other words there have to be just one view to consume the touch. So there are multiple ways to dispatch the touch event to your desired view.

  1. Change the views z-order on the screen by calling View#bringToFront() on the view you wish to dispatch touch events.

  2. Extend your ImageView and override onInterceptTouchEvent method and make it return false whenever you need the underneath view to receive the touch.

  3. Make your own custom view which contains your images and pass the touch event to the your desired view.

Sdghasemi
  • 5,370
  • 1
  • 34
  • 42