Android Guides | Samples

Android.Views.DragAction Enumeration

Enumerates values returned by several types.

Syntax

public enum DragAction

Remarks

Members

Member NameDescription
Drop

Action constant returned by DragEvent.Action: Signals to a View that the user has released the drag shadow, and the drag point is within the bounding box of the View. The View should retrieve the data from the DragEvent by calling DragEvent.ClipData. The methods DragEvent.GetX and DragEvent.GetY return the X and Y position of the drop point within the View object's bounding box.

The View should return true from its View.OnDragEvent(DragEvent) handler or IOnDragListener.OnDrag(View,DragEvent) listener if it accepted the drop, and false if it ignored the drop.

The View can also react to this action by changing its appearance.

Ended

Action constant returned by DragEvent.Action: Signals to a View that the drag and drop operation has concluded. A View that changed its appearance during the operation should return to its usual drawing state in response to this event.

All views that received an ACTION_DRAG_STARTED event will receive the ACTION_DRAG_ENDED event even if they are not currently visible when the drag ends.

The View object can call DragEvent.Result to see the result of the operation. If a View returned true in response to DragAction.Drop, then getResult() returns true, otherwise it returns false.

Entered

Action constant returned by DragEvent.Action: Signals to a View that the drag point has entered the bounding box of the View. The system stops sending ACTION_DRAG_LOCATION events to a View once the user moves the drag shadow out of the View object's bounding box. If the user moves the drag shadow back into the View object's bounding box, the View receives an ACTION_DRAG_ENTERED again before receiving any more ACTION_DRAG_LOCATION events.

If the View can accept a drop, it can react to ACTION_DRAG_ENTERED by changing its appearance in a way that tells the user that the View is the current drop target.

Exited

Action constant returned by DragEvent.Action: Signals that the user has moved the drag shadow outside the bounding box of the View. The View can react by changing its appearance in a way that tells the user that View is no longer the immediate drop target.

After the system sends an ACTION_DRAG_EXITED event to the View, the View receives no more ACTION_DRAG_LOCATION events until the user drags the drag shadow back over the View.

Location

Action constant returned by DragEvent.Action: Sent to a View after DragAction.Entered if the drag shadow is still within the View object's bounding box. The DragEvent.GetX and DragEvent.GetY methods supply the X and Y position of of the drag point within the View object's bounding box.

A View receives an DragAction.Entered event before receiving any ACTION_DRAG_LOCATION events.

The system stops sending ACTION_DRAG_LOCATION events to a View once the user moves the drag shadow out of the View object's bounding box. If the user moves the drag shadow back into the View object's bounding box, the View receives an ACTION_DRAG_ENTERED again before receiving any more ACTION_DRAG_LOCATION events.

Started

Action constant returned by DragEvent.Action: Signals the start of a drag and drop operation. The View should return true from its View.OnDragEvent(DragEvent) handler method or IOnDragListener.OnDrag(View,DragEvent) listener if it can accept a drop. The onDragEvent() or onDrag() methods usually inspect the metadata from DragEvent.ClipDescription to determine if they can accept the data contained in this drag. For an operation that doesn't represent data transfer, these methods may perform other actions to determine whether or not the View should accept the drag. If the View wants to indicate that it is a valid drop target, it can also react by changing its appearance.

A View only receives further drag events if it returns true in response to ACTION_DRAG_STARTED.

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Android.Views.DragAction are listed below.

See Also: Enum

Public Fields

DropDragAction.

Action constant returned by DragEvent.Action: Signals to a View that the user has released the drag shadow, and the drag point is within the bounding box of the View. The View should retrieve the data from the DragEvent by calling DragEvent.ClipData. The methods DragEvent.GetX and DragEvent.GetY return the X and Y position of the drop point within the View object's bounding box.

The View should return true from its View.OnDragEvent(DragEvent) handler or IOnDragListener.OnDrag(View,DragEvent) listener if it accepted the drop, and false if it ignored the drop.

The View can also react to this action by changing its appearance.

EndedDragAction.

Action constant returned by DragEvent.Action: Signals to a View that the drag and drop operation has concluded. A View that changed its appearance during the operation should return to its usual drawing state in response to this event.

All views that received an ACTION_DRAG_STARTED event will receive the ACTION_DRAG_ENDED event even if they are not currently visible when the drag ends.

The View object can call DragEvent.Result to see the result of the operation. If a View returned true in response to DragAction.Drop, then getResult() returns true, otherwise it returns false.

EnteredDragAction.

Action constant returned by DragEvent.Action: Signals to a View that the drag point has entered the bounding box of the View. The system stops sending ACTION_DRAG_LOCATION events to a View once the user moves the drag shadow out of the View object's bounding box. If the user moves the drag shadow back into the View object's bounding box, the View receives an ACTION_DRAG_ENTERED again before receiving any more ACTION_DRAG_LOCATION events.

If the View can accept a drop, it can react to ACTION_DRAG_ENTERED by changing its appearance in a way that tells the user that the View is the current drop target.

ExitedDragAction.

Action constant returned by DragEvent.Action: Signals that the user has moved the drag shadow outside the bounding box of the View. The View can react by changing its appearance in a way that tells the user that View is no longer the immediate drop target.

After the system sends an ACTION_DRAG_EXITED event to the View, the View receives no more ACTION_DRAG_LOCATION events until the user drags the drag shadow back over the View.

LocationDragAction.

Action constant returned by DragEvent.Action: Sent to a View after DragAction.Entered if the drag shadow is still within the View object's bounding box. The DragEvent.GetX and DragEvent.GetY methods supply the X and Y position of of the drag point within the View object's bounding box.

A View receives an DragAction.Entered event before receiving any ACTION_DRAG_LOCATION events.

The system stops sending ACTION_DRAG_LOCATION events to a View once the user moves the drag shadow out of the View object's bounding box. If the user moves the drag shadow back into the View object's bounding box, the View receives an ACTION_DRAG_ENTERED again before receiving any more ACTION_DRAG_LOCATION events.

StartedDragAction.

Action constant returned by DragEvent.Action: Signals the start of a drag and drop operation. The View should return true from its View.OnDragEvent(DragEvent) handler method or IOnDragListener.OnDrag(View,DragEvent) listener if it can accept a drop. The onDragEvent() or onDrag() methods usually inspect the metadata from DragEvent.ClipDescription to determine if they can accept the data contained in this drag. For an operation that doesn't represent data transfer, these methods may perform other actions to determine whether or not the View should accept the drag. If the View wants to indicate that it is a valid drop target, it can also react by changing its appearance.

A View only receives further drag events if it returns true in response to ACTION_DRAG_STARTED.