добавление текстового интерфейса для перетаскивания – Android / Java

У меня есть gridView, который я построил из следующего учебника / примера:

http://blahti.wordpress.com/2012/03/03/improved-drag-drop-for-gridview/

Как есть – источник примера (доступен для скачивания по ссылке ниже) позволяет перетащить новый квадрат imageView и поместить его в gridview.

То, что я пытаюсь сделать сейчас, – это создать текстовый файл, который можно перетаскивать (вместе с imageView), чтобы создать папку с заголовком, которую можно перетаскивать и удалять.

До сих пор мне удалось создать свои собственные настраиваемые (новые fragmentы и т. Д., А также editText, который по клику станет текстовым), gridView, а также isntantiated textView – я просто не могу заставить его двигаться с изображением при перетаскивании.

/** * 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(); } 

Interesting Posts

Центрирование текста в JTextArea или JTextPane – горизонтальное выравнивание текста

уловить все необработанные исключения в ASP.NET Web Api

Странность после переустановки операционной системы Windows

Заменить шрифт Windows XP по умолчанию (Tahoma)

Как записывать системные звуки (приложения) в Audacity?

Ограничить длину текста EditText в Android

Как искать не ssl google?

Восстановление массива RAID 0 (без отказов дисков), если я знаю размер блока и начальное смещение?

Как изменить меню загрузки для Windows 7?

Как правильно заменить материнскую плату и процессор на компьютере с Windows 7?

Как я могу запустить команду AppleScript или оболочки в Mac OS X при разблокировке экрана?

Идея избежать этого spring.handlers / spring.schemas будет перезаписана при слиянии нескольких весенних зависимостей в одной банке

Насколько вероятно, что я столкнулся с ошибкой MemTest +?

Отправка файлов через Bluetooth

Удаляет ли вызов деструктор?

Давайте будем гением компьютера.