Android firing onTouch event for multiple ImageViews

后端 未结 2 540
借酒劲吻你
借酒劲吻你 2020-12-20 07:25

I have several ImageViews, and I want the onTouch event to fire for each of them when I drag my finger across multiple images. At present the onTouch event is only firing on

2条回答
  •  爱一瞬间的悲伤
    2020-12-20 07:47

    Yes, I had the same problem. The answer was to create a touch listener for the layout I embed my ImageViews in and then to calculate the X, Y position to know above which of my View am I. OnTouchListener is called only for the view it is connected to. I mean if it is called for an ImageView it won't fire until you start your motion onto that ImageView, as far as I know.

提交回复
热议问题