在两个片段之间拖放 [英] Drag and drop between two fragments
问题描述
我想将视图从一个片段拖动到另一个片段中。我可以在片段之间拖动它,但是我面对的不是很好,所以我不能在第二个片段上侦听第一个片段视图的onDrag。
简而言之,第二个片段上的OnDragListener应该监听从第一个片段拖动的视图。
我已经搜索很多在google和stackoverflow。没有找到任何答案。
我有人知道请分享。
您是否考虑过在两个片段之间创建一个覆盖视图,这些片段不应该拦截触摸,但是一旦你开始拖动视图,它的副本将是在这个叠加层中创建并跟随拖动?我看不到任何其他方法来实现,因为两个片段具有单独的视图层次结构,唯一的方法可以看到是通过活动的视图层次结构转移视图
BTW有没有办法避免使用两个片段?你有什么样的用例?
I am working on drag and drop between two different fragments visible at same time on UI.
I want to drag view from one fragment into the other fragment. I am able to drag it between the fragment but what i am facing not good is that i can't listen onDrag on second fragment for the view of first fragment.
In Short the OnDragListener on second fragment should listen for the views dragged from first fragment.
I have searched alot on google and stackoverflow. Didn't find any answer.
Drag and Drop view between two Fragments
drag and drop between two fragments?
I somebody knows please share.
Have you considered creating an overlaying View above both Fragments, which should not intercept touches, but as soon as you start dragging the view - a copy of it will be created in this overlay and follow the dragging? I can't see any other way of implementing this, since two Fragments have separate view hierarchies and the only way I can see is transfer the View through Activity's view hierarchy
BTW is there any way to avoid using of two Fragments? What kind of use case do you have?
这篇关于在两个片段之间拖放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!