嗨,我想在这个应用程序中创建一个应用程序用户通过拖放图像(如计算机中的 edraw 软件)创建流程图请提前告诉我如何实现这个 Thans
user1379751
问问题
376 次
1 回答
2
一个样品:
private void dragImage() {
imgLogo.setOnLongClickListener(new
OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
// ClipData data = ClipData.newPlainText("dot",
// "Dot : " + v.toString());
ClipData data = ClipData
.newPlainText("dot",
"Oops!\r\nWe are pleased that we have such clever customers! ;)");
MyDragShadowBuilder myShadow = new MyDragShadowBuilder(
v);
v.startDrag(data, myShadow, (Object) v, 0);
return false;
}
});
imgLogo.setClickable(true);
imgLogo.setFocusable(true);
imgLogo.setOnDragListener(new OnDragListener() {
@Override
public boolean onDrag(View v, DragEvent event) {
final int action = event.getAction();
// if (myShadow != null)
// myShadow.setCurrentPosition(event.getX(), event.getY());
switch (action) {
case DragEvent.ACTION_DRAG_STARTED: {
imgLogo.setVisibility(View.INVISIBLE);
}
break;
case DragEvent.ACTION_DRAG_ENDED: {
// Hide the surprise again
imgLogo.setVisibility(View.VISIBLE);
// Report the drop/no-drop result to the user
final boolean dropped = event.getResult();
// tvGalleryLblQty.setText("ended");
}
break;
case DragEvent.ACTION_DROP: {
final boolean dropped = event.getResult();
}
break;
}
return false;
}
});
}
于 2012-05-09T07:18:49.987 回答