2
我需要拖放我的新項目。我提到blogpost。但是我在執行Drop時遇到問題。我無法看到我持有的圖像,也無法查看。我使用的DragListner如下所示。我不知道如何處理這個暈眩。如何處理拖放圖像視圖中的拖放事件?
class MyDragListener implements OnDragListener {
@Override
public boolean onDrag(View view, DragEvent dragEvent) {
int dragAction = dragEvent.getAction();
View dragView = (View) dragEvent.getLocalState();
if (dragAction == DragEvent.ACTION_DRAG_EXITED) {
System.out.println("exit------------");
containsDragable = false;
} else if (dragAction == DragEvent.ACTION_DRAG_ENTERED) {
System.out.println("enter------------");
containsDragable = true;
} else if (dragAction == DragEvent.ACTION_DRAG_ENDED) {
System.out.println("end------------");
dragView.setVisibility(View.VISIBLE);
} else if (dragAction == DragEvent.ACTION_DROP && containsDragable) {
dragView.setVisibility(View.VISIBLE);
}
return true;
}