/// <summary> /// Starts a drag. /// It creates a bitmap of the view being dragged. That bitmap is what you see moving. /// The actual view can be repositioned if that is what the onDrop handle chooses to do. /// </summary> /// <param name="v"> The view that is being dragged </param> /// <param name="source"> An object representing where the drag originated </param> /// <param name="dragInfo"> The data associated with the object that is being dragged </param> /// <param name="dragAction"> The drag action: either <seealso cref="#DRAG_ACTION_MOVE"/> or /// <seealso cref="#DRAG_ACTION_COPY"/> </param> public void StartDrag(View v, IDragSource source, object dragInfo, int dragAction) { // Start dragging, but only if the source has something to drag. bool doDrag = source.AllowDrag(); if (!doDrag) { return; } mOriginator = v; Bitmap b = GetViewBitmap(v); if (b == null) { // out of memory? return; } int[] loc = mCoordinatesTemp; v.GetLocationOnScreen(loc); int screenX = loc[0]; int screenY = loc[1]; StartDrag(b, screenX, screenY, 0, 0, b.Width, b.Height, source, dragInfo, dragAction); b.Recycle(); if (dragAction == DRAG_ACTION_MOVE) { v.Visibility = ViewStates.Gone; } }