How to Drag drop Listview item to another Listview

时间秒杀一切 提交于 2019-11-28 09:13:43

Hello I'm developing an example of this in github https://github.com/mtparet/Drag-And-Drop-Android

It could help you.

All contribution are welcome

Take a look at this sample that Drag and drop inside a List View..

Drag and drop sample...Click on You can find the project here. and Download the Zip file..

The ACTION_UP and ACTION_DOWN constants returned by MotionEvent.getAction() refer to the state of finger taps (for example, finger is placed down on screen, finger is lifted up from screen), not to movement direction. You will need to also use the MOVE action in combination with ACTION_UP and ACTION_DOWN to accomplish what you're trying to do.

For example, in your onTouch method, when you receive MOTION_DOWN (user has pressed down on the ListView item), identify which item the user tapped on. You can then track the MOVE action to give visual cues, such as to draw a floating "ghost" version of the item that follows their finger. Finally, when you receive MOTION_UP (user lifted their finger after dragging), identify which column their finger was over and do whatever you need to do to move the data over to the other list.

You can use the x and y coordinates provided with each MotionEvent to determine things like which item the user tapped on, which list they moved their finger over, etc.

hope http://techdroid.kbeanie.com/2011/10/drag-and-drop-honeycombics.html this will solve your problem up to some extend but still not got the perfect solution....

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!