public class DragEvent extends Object
Drag events are generated at various times during a drag and drop operation, that is, a user holds down an object and then drags it to another location.
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
DRAG_BEGIN |
Indicates the start of a drag and drop operation.
|
static int |
DRAG_DROP |
Indicates that a drag event is finished.
|
static int |
DRAG_FINISH |
Indicates that the object is deleted.
|
static int |
DRAG_IN |
Indicates that the drag point has entered the area of the drop target.
|
static int |
DRAG_MOVE |
Indicates that an object is being moved during a drag and drop operation.
|
static int |
DRAG_OUT |
Indicates that the dragged object is moved out of the drop target.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getAction() |
Obtains
action. |
MimeData |
getClipData() |
已过时。
This change is effective since API version 5. Replaced by
getMimeData() |
MimeData |
getMimeData() |
Obtains the
MimeData of a drag event. |
float |
getX() |
Obtains the X coordinate of the drag point.
|
float |
getY() |
Obtains the Y coordinate of the drag point.
|
boolean |
isBroadcast() |
Determines whether a drag event is being broadcasted.
|
static DragEvent |
obtain(int action,
float x,
float y,
MimeData mimeData) |
A constructor used to create a new
DragEvent instance. |
public static final int DRAG_BEGIN
public static final int DRAG_DROP
public static final int DRAG_FINISH
public static final int DRAG_IN
public static final int DRAG_MOVE
public static final int DRAG_OUT
public static DragEvent obtain(int action, float x, float y, MimeData mimeData)
DragEvent instance.action - Indicates the action ID.x - Indicates the X coordinate of the drag point.y - Indicates the Y coordinate of the drag point.mimeData - The MimeData of draggable component.DragEvent instance.public final int getAction()
action.
This method obtains the action ID of an event.
public final float getX()
public final float getY()
@Deprecated public final MimeData getClipData()
getMimeData()MimeData of a drag event.MimeData of the drag event.public final MimeData getMimeData()
MimeData of a drag event.MimeData of the drag event.public boolean isBroadcast()
A drag event is considered being broadcasted if any of the following actions occur:
DRAG_BEGIN, DRAG_MOVE, and DRAG_FINISH.
true if the drag event is being broadcasted; returns false otherwise.