与画廊捏缩放
我正在尝试结合执行图像缩放/平移的功能 图库视图内部。问题是控制哪个触摸 事件由每个事件处理。在图像上水平拖动时, ImageView 需要处理拖动才能平移,直到边缘 到达图像的后,图库视图需要处理 触摸事件,以便可以滑动到下一张照片。 看来如果我从 imageview 的 ontouchevent 返回 false, 那么我将不会收到平移拖动移动事件的通知。 我试图做的是从 imageview 的 ontouchevent 返回 true 直到图像边缘被击中然后返回 false。然而我 相信这不会导致画廊开始处理这些 事件,因为它错过了最初的着陆事件。 我的下一个想法是以某种方式将包含活动转变为 触摸处理程序,并以某种方式阻止 Gallery 和 ImageView 获取 正常触摸事件,并让 Activity 转发触摸事件 手动。不确定这是否可能或是否有例子。 我的最后一招就是不使用 android.widget.Gallery, 我想避免,因为我希望小部件“感觉”与 手机上的其他地方,我喜欢代码重用。不幸的是我 可能必须这样做,因为我看到所有其他具有此缩放/平移的应用程序 功能似乎不使用图库小部件(Gallery3D 等)。 我的问题是,针对这种情况设计的最佳方法是什么 Motionevents 需要在两个视图之间拆分吗?任何想法都会 非常感谢,谢谢。
I'm trying to combine the capability of doing image zoom/panning
inside of a Gallery view. The problem is controlling which touch
events are processed by each. In a horizontal drag on the image, the
ImageView needs to process the drag in order to pan, up until the edge
of the image is reached then the gallery view needs to process the
touch event so that it can swipe over to the next photo.
It seems that if I return false from the imageview's ontouchevent,
then I won't be notified of the panning-drag move events.
What I tried to do was return true from the imageview's ontouchevent
until the edge of the image was hit then return false. However I
believe that this doesn't cause the Gallery to begin processing these
events, as it missed the initial touchdown event.
My next thought is to somehow turn the containing activity into the
touch handler, and somehow stop the Gallery and ImageView from getting
touch events normally, and have the activity forward the touch event's
manually. Not sure if this is possible or if there is an example.
My last resort will be to simply not use the android.widget.Gallery,
which I want to avoid because I want the widget to "feel" the same as
other places on the phone, and I like code re-use. Unfortunately I
might have to do this, as I see all other apps that have this zoom/pan
capability don't seem to use the Gallery widget (Gallery3D etc).
My question is, what's the best way to design for this situation where
motionevents need to split between two views? Any ideas would be
greatly appreciated thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请点击此处的链接。
http://jmsliu.com/138/android-infinite-loop-gallery.html
please follow the links here.
http://jmsliu.com/138/android-infinite-loop-gallery.html