简体   繁体   English

如何在拖动事件中选择多个复选框

[英]How to select multiple checkboxes in a Drag event

We have multiple checkboxes, as shown below: 我们有多个复选框,如下所示:

在此处输入图片说明

We want the user to be able to select first checkbox for A,B,C, by him dragging over the checkboxes. 我们希望用户能够通过拖移复选框来选择A,B,C的第一个复选框。 Is this possible in android? 这可能在android中吗?

Yes, you could do something like that. 是的,您可以做类似的事情。 You'd have to first start a drag operation and drag a view. 您必须首先开始拖动操作并拖动视图。 If you tried to do it with just your finger, it would be an exercise in gesture detection. 如果您尝试只用手指来做,那将是手势检测中的一种练习。 But dragging a view would be simple. 但是拖动视图很简单。

Using this tutorial as a guide - http://developer.android.com/guide/topics/ui/drag-drop.html - you should be able to start a drag operation using a click listener on the view you want to drag. 使用本教程作为指南-http://developer.android.com/guide/topics/ui/drag-drop.html-您应该能够在要拖动的视图上使用单击侦听器来启动拖动操作。 Then, as the dragged view enters the bounding boxes (you set up draglisteners on each) of a checkbox, you can set it to checked. 然后,当拖动的视图进入复选框的边界框(在每个框上设置了拖动侦听器)时,可以将其设置为选中状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM