共用方式為


DragEvent Class

Definition

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

[Android.Runtime.Register("android/view/DragEvent", DoNotGenerateAcw=true)]
public class DragEvent : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/view/DragEvent", DoNotGenerateAcw=true)>]
type DragEvent = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
DragEvent
Attributes
Implements

Remarks

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

View objects that receive a DragEvent call #getAction(), 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 #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 #getAction() value is listed in the first column. The other columns indicate which method or methods return valid data for that getAction() value:

<table> <tr> <th scope="col">getAction() Value</th> <th scope="col">getClipDescription()</th> <th scope="col">getLocalState()</th> <th scope="col">getX()</th> <th scope="col">getY()</th> <th scope="col">getClipData()</th> <th scope="col">getResult()</th> </tr> <tr> <td>ACTION_DRAG_STARTED</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> </tr> <tr> <td>ACTION_DRAG_ENTERED</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> </tr> <tr> <td>ACTION_DRAG_LOCATION</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> </tr> <tr> <td>ACTION_DRAG_EXITED</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> </tr> <tr> <td>ACTION_DROP</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">X</td> <td style="text-align: center;">&nbsp;</td> </tr> <tr> <td>ACTION_DRAG_ENDED</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">X</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">&nbsp;</td> <td style="text-align: center;">X</td> </tr> </table>

The android.view.DragEvent#getAction(), android.view.DragEvent#getLocalState()android.view.DragEvent#describeContents(), android.view.DragEvent#writeToParcel(Parcel,int), and android.view.DragEvent#toString() methods always return valid data.

<div class="special reference"> <h3>Developer Guides</h3>

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

</div>

Java documentation for android.view.DragEvent.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

DragEvent(IntPtr, JniHandleOwnership)

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

Properties

Action

Inspect the action value of this event.

Class

Returns the runtime class of this Object.

(Inherited from Object)
ClipData

Returns the android.content.ClipData object sent to the system as part of the call to android.view.View#startDragAndDrop(ClipData,View.DragShadowBuilder,Object,int) startDragAndDrop().

ClipDescription

Returns the android.content.ClipDescription object contained in the android.content.ClipData object sent to the system as part of the call to android.view.View#startDragAndDrop(ClipData,View.DragShadowBuilder,Object,int) startDragAndDrop().

Creator

A container for creating a DragEvent from a Parcel.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
LocalState

Returns the local state object sent to the system as part of the call to android.view.View#startDragAndDrop(ClipData,View.DragShadowBuilder,Object,int) startDragAndDrop().

PeerReference (Inherited from Object)
Result

Returns an indication of the result of the drag and drop operation.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()

Returns information about the android.os.Parcel representation of this DragEvent object.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetX()

Gets the X coordinate of the drag point.

GetY()

Gets the Y coordinate of the drag point.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Creates a android.os.Parcel object from this DragEvent object.

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to