问题描述
- 我们有图库,支持刷卡。
- 我们也有支持双指缩放的ImageView的第三方组件,如ImageViewTouch在 ImageViewZoom 。
- We have the Gallery, which support swiping.
- We also have 3rd-party components that support pinch-to-zoom on ImageView, such as ImageViewTouch in ImageViewZoom.
现在,我想他们两个结合起来。
的问题是,在扫掠事件获得由ImageViewTouch而错过了画廊。
The problem is that the swipe events get consumed by the ImageViewTouch and missed by the Gallery.
如何使用由两个组件的事件?
这将解决我的问题,因为,最终,经过几次事件,每个组件都知道如何做出相应的反应。例如,如果第一事件是ACTION_DOWN,它可以是一个夹送到变焦刷卡或部分的一部分。这两个组件(图库和ImageViewTouch)应该使用它,才能知道该怎么做下列活动。
That would solve my problem, because, eventually, after a few events, each component will know how to react accordingly.For example, if the first event is ACTION_DOWN, it can be part of a pinch-to-zoom or part of a swipe. Both components (Gallery and ImageViewTouch) should consume it in order to know what to do in following events.
推荐答案
我改变了一些code在ImageViewZoom结合这两个组件。这种变化是对事件是否是由ImageViewTouch消耗的返回值。如果是的话,比该事件不应该被传递到画廊。如果事件没有被消耗的ImageView,比像册要消耗它(如果可以)。
I combined both components by changing some code in ImageViewZoom. The change was for the events to return a value if they were consumed by the ImageViewTouch. If so, than the event should not be passed to the gallery. If the event is not consumed by the ImageView, than the gallery should consume it (if it can).
还有一些小问题,但它的功能。希望其他人在社会上能有所帮助。
There are still some small issues, but it's functional. Hopefully other people in the community can help.
下面是在GitHub上叉: https://github.com/kilaka/ImageViewZoom
Here's the fork on github: https://github.com/kilaka/ImageViewZoom
感谢。
这篇关于Android的 - 结合刷卡,捏到变焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!