Android Guides | Samples

Android.Views.DragEvent Class

Represents an event that is sent out by the system at various times during a drag and drop operation.

See Also: DragEvent

Syntax

[Android.Runtime.Register("android/view/DragEvent", DoNotGenerateAcw=true)]
public class DragEvent : Object, IParcelable, IDisposable

Remarks

Represents an event that is sent out by the system at various times during a drag and drop operation. It is a complex data structure that contains several important pieces of data about the operation and the underlying data.

getAction() ValuegetClipDescription()getLocalState()getX()getY()getClipData()getResult()
ACTION_DRAG_STARTEDXXXX  
ACTION_DRAG_ENTEREDXX    
ACTION_DRAG_LOCATIONXXXX  
ACTION_DRAG_EXITEDXX    
ACTION_DROPXXXXX 
ACTION_DRAG_ENDEDXX   X

Developer Guides

View objects that receive a DragEvent call DragEvent.Action, which returns an action type that indicates the state of the drag and drop operation. This allows a View object to react to a change in state by changing its appearance or performing other actions. For example, a View can react to the DragEvent.ACTION_DRAG_ENTERED action type by by changing one or more colors in its displayed image.

During a drag and drop operation, the system displays an image that the user drags. This image is called a drag shadow. Several action types reflect the position of the drag shadow relative to the View receiving the event.

Most methods return valid data only for certain event actions. This is summarized in the following table. Each possible DragEvent.Action value is listed in the first column. The other columns indicate which method or methods return valid data for that getAction() value:

The DragEvent.Action, DragEvent.DescribeContents, DragEvent.WriteToParcel(Parcel,ParcelableWriteFlags), and DragEvent.toString() methods always return valid data.

For a guide to implementing drag and drop features, read the Drag and Drop developer guide.

[Android Documentation]

Requirements

Namespace: Android.Views
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 11

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

See Also: Object

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

[read-only]
ActionDragAction. Inspect the action value of this event.
[read-only]
ClipDataClipData. Returns the ClipData object sent to the system as part of the call to View.StartDrag(Android.Content.ClipData, .DragShadowBuilder, .DragShadowBuilder, .DragShadowBuilder).
[read-only]
ClipDescriptionClipDescription. Returns the ClipDescription object contained in the ClipData object sent to the system as part of the call to View.StartDrag(Android.Content.ClipData, .DragShadowBuilder, .DragShadowBuilder, .DragShadowBuilder).
[read-only]
static
CreatorIParcelableCreator. A container for creating a DragEvent from a Parcel.
[read-only]
LocalStateObject. Returns the local state object sent to the system as part of the call to View.StartDrag(Android.Content.ClipData, .DragShadowBuilder, .DragShadowBuilder, .DragShadowBuilder).
[read-only]
ResultBoolean.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

DescribeContents() : Int32
Returns information about the Parcel representation of this DragEvent object.
GetX() : Single
Gets the X coordinate of the drag point.
GetY() : Single
Gets the Y coordinate of the drag point.
WriteToParcel(Parcel, ParcelableWriteFlags)
Creates a Parcel object from this DragEvent object.