Android Drag and Drop ACTION_DRAG_ENDED not firing

后端 未结 2 1406
伪装坚强ぢ
伪装坚强ぢ 2021-02-12 23:43

I\'m really having a time figuring this one out and can\'t find any friends with the relevant experience so far. It\'s my VERY LAST FEATURE before I release my VERY FIRST APP s

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-13 00:17

    Views that need to be notified of drag events must register OnDragListeners. If they need to be aware when specific things or types of things move, for instance in order to change their appearance (either to a "DRAG ME HERE!" or a "DON'T YOU DARE DROP THAT ON ME!"). Even if your view is not a valid place to drop the object being dragged, if it needs to be 'drag context aware' so to speak, it registers an OnDragListener and returns true forACTION_DRAG_STARTED.

    The one thing I'm missing from your very thorough question is what exactly you need to be cleaned up? If you just need to do some generic things that are in the scope of the activity, you might consider adding a different OnDragListener to the base RelativeLayout that registers for the events but waits for ACTION_DRAG_ENDED to alert the activity to perform your generic cleanup code

提交回复
热议问题