agregando una interfaz textView to Drag and Drop-Android/Java
gridview drag-and-drop (0)
Tengo un gridView I''ve build del siguiente tutorial / ejemplo:
http://blahti.wordpress.com/2012/03/03/improved-drag-drop-for-gridview/
Tal como está: la fuente del ejemplo (disponible para descargar en el siguiente enlace) permite arrastrar y soltar un nuevo imageView cuadrado y colocarlo dentro de la vista grid.
Lo que estoy intentando lograr ahora es poder crear un textView que se pueda arrastrar y soltar (junto con el imageView) para crear una carpeta con un título que se pueda arrastrar y soltar.
Hasta ahora, he logrado crear mi propia versión personalizada (nuevos mosaicos, etc., así como un editText que al hacer clic se convierte en una versión de TextView) de gridView, así como también una vista de texto, simplemente no puedo conseguir que avance. con imageView cuando se arrastra.
/**
* Interface defining an object that reacts to objects being dragged over and dropped onto it.
*
*/
public interface DropTarget {
/**
* Handle an object being dropped on the DropTarget
*
* @param source DragSource where the drag started
* @param x X coordinate of the drop location
* @param y Y coordinate of the drop location
* @param xOffset Horizontal offset with the object being dragged where the original
* touch happened
* @param yOffset Vertical offset with the object being dragged where the original
* touch happened
* @param dragView The DragView that''s being dragged around on screen.
* @param dragInfo Data associated with the object being dragged
*
*/
void onDrop(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo);
/**
* React to something started to be dragged.
*/
void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo);
/**
* React to something being dragged over the drop target.
*/
void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo);
/**
* React to a drag
*/
void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo);
/**
* Check if a drop action can occur at, or near, the requested location.
* This may be called repeatedly during a drag, so any calls should return
* quickly.
*
* @param source DragSource where the drag started
* @param x X coordinate of the drop location
* @param y Y coordinate of the drop location
* @param xOffset Horizontal offset with the object being dragged where the
* original touch happened
* @param yOffset Vertical offset with the object being dragged where the
* original touch happened
* @param dragView The DragView that''s being dragged around on screen.
* @param dragInfo Data associated with the object being dragged
* @return True if the drop will be accepted, false otherwise.
*/
boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo);
/**
* Estimate the surface area where this object would land if dropped at the
* given location.
*
* @param source DragSource where the drag started
* @param x X coordinate of the drop location
* @param y Y coordinate of the drop location
* @param xOffset Horizontal offset with the object being dragged where the
* original touch happened
* @param yOffset Vertical offset with the object being dragged where the
* original touch happened
* @param dragView The DragView that''s being dragged around on screen.
* @param dragInfo Data associated with the object being dragged
* @param recycle {@link Rect} object to be possibly recycled.
* @return Estimated area that would be occupied if object was dropped at
* the given location. Should return null if no estimate is found,
* or if this target doesn''t provide estimations.
*/
Rect estimateDropLocation(DragSource source, int x, int y, int xOffset, int yOffset,
DragView dragView, Object dragInfo, Rect recycle);
// These methods are implemented in Views
void getHitRect(Rect outRect);
void getLocationOnScreen(int[] loc);
int getLeft();
int getTop();
}