在 HorizontalPager (RealViewSwitcher) android 中捏合缩放 ImageView
有“双击缩放”/“捏合缩放”ImageView (ImageViewTouch) 来自 这里。
还有 Yoni Samlan 的“Horizontal Pager”这里。
请帮助我如何在“HorizontalPager”中嵌入捏缩放图像视图(ImageViewTouch)。我在这方面面临困难,因为两个类都使用 onTouchEvent()。
注意:HorizontalPager 对象内有多个 ImageViewTouch 对象(预计允许捏缩放和滑动到另一个图像 (ImageViewTouch)
There is "double tap to zoom" / "pinch to zoom" ImageView (ImageViewTouch) from here.
And there is "Horizontal Pager" by Yoni Samlan here.
Please help me how to embed pinch-zoom imageview (ImageViewTouch) inside "HorizontalPager". I am facing difficulty in this as both classes uses onTouchEvent().
Note: Multiple ImageViewTouch objects inside HorizontalPager object (which is expected to allow pinch-zooming and sliding to another image (ImageViewTouch)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就这样完成了...
HorizontalPager 将首先捕获 onTouchEvent()。它将把事件传递给子视图,即 ImageViewTouch。如果它处理了该事件(由 onTouchEvent() 返回的布尔值确定),它也将简单地从 onTouchEvent() 返回处理后的状态。如果子视图(ImageViewTouch)没有处理事件,它将通过采取与该事件相关的必要操作来处理该事件,并按处理后的状态返回。
当然,我对 HorizontalPager 和 ImageViewTouch 类做了一些修改来协调这一点。
It's done, this way...
HorizontalPager will trap the onTouchEvent() first. It will pass the event to child view which is ImageViewTouch. If it handled the event (determined by boolean value returned by onTouchEvent()), It will also simply return from onTouchEvent() as handled. If child view (ImageViewTouch) did not handle event, it will handle this event by taking necessary action related to the event and return as handled.
Of course I have done some modifications to HorizontalPager and ImageViewTouch classes to co-ordinate this.