如何在 android 2.2 中实现拖放? [英] How to implement Drag and Drop in android 2.2?

查看:38
本文介绍了如何在 android 2.2 中实现拖放?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试开发一个 android 应用程序,用户应该能够将图像从网格的一个单元格拖动到另一个单元格.为了实现这一点,我需要在 Android 3.0 中引入的拖放 API,但我的应用程序应该在 Android 2.2 中运行.那么,有没有办法使用触摸事件来实现这一点?如果是,那么请提供一些代码片段或任何简要描述它的链接.

I am trying to develop an android app, where user should be able to drag images from one cell of a grid to another. To implement this I need Drag and Drop API which was introduced in Android 3.0, but my app should run in Android 2.2. So, is there a way to implement this using Touch events? If yes, then please provide me some code snippet or any link which describes it briefly.

推荐答案

TouchEvent:TouchDown -> LockItemOnTouchPoint

TouchEvent:TouchDown -> LockItemOnTouchPoint

FollowTouchDirections -> UpdateItemPosition

FollowTouchDirections -> UpdateItemPosition

TouchEvent:TouchUp -> LockItemPosition

TouchEvent:TouchUp -> LockItemPosition

这篇关于如何在 android 2.2 中实现拖放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆