您的位置:首页 > 财经 > 金融 > 南昌百度seo_客服外包10大平台_头条权重查询站长工具_网站链接提交

南昌百度seo_客服外包10大平台_头条权重查询站长工具_网站链接提交

2024/12/22 13:03:53 来源:https://blog.csdn.net/u013718730/article/details/143430764  浏览:    关键词:南昌百度seo_客服外包10大平台_头条权重查询站长工具_网站链接提交
南昌百度seo_客服外包10大平台_头条权重查询站长工具_网站链接提交
Build Drag Data

build a ClipData and specify an Intent, to deliver data that you want post on drop

val intent = Intent()
val data = ClipData.newIntent("CustomDragType", intent)
Start Drag
val shadow = DragShadowBuilder(view)
view.startDragAndDrop(data, shadow, null, 0)
Response DragAndDrop Event

there are two ways to drop an element

  • drop onto a view
  • drop into blank spaces between serveral views

in case 1, you can use the target view responsing drop event

in case 2, you can use a common parent view responsing drop event

then decide which child to handle event, by comparing event’s coordinate to view’s coordinate

dropView.setOnDragListener { v, event ->if (event.action == DragEvent.ACTION_DRAG_ENDED) {val point = Point(event.x.toInt(), event.y.toInt())val data = event.clipData.getItemAt(0).intenthandleDropEvent(v, point, data)dragView.cancelDragAndDrop()}return@setOnDragListener true
}
Utils
fun DragEvent.name() = when (action) {ACTION_DRAG_STARTED -> "START"ACTION_DRAG_ENTERED -> "ENTER"ACTION_DRAG_LOCATION -> "LOCATION"ACTION_DRAG_EXITED -> "EXIT"ACTION_DROP -> "DROP"ACTION_DRAG_ENDED -> "END"else -> "NONE"
}fun DragEvent.info() = "${name()} $x $y"

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com