我的Imageview
在网格布局中当我触摸imageview时我有一个ontouchlisteners我在Invisible中设置它,当我删除Imageview时我有一个DragListener
错误(ConcurrentModificationException的)
出现我想要做的是当我放下Imageview Imageview
I Touch再次设置为Visible时。
我该如何做到这一点?
这是我的代码
@Override
public boolean onDrag(View v, DragEvent event) {
int dragEvent = event.getAction();
final View views = (View)event.getLocalState();
switch (dragEvent) {
case DragEvent.ACTION_DRAG_ENTERED:
break;
case DragEvent.ACTION_DRAG_EXITED:
break;
case DragEvent.ACTION_DROP:
views.setVisibility(View.VISIBLE);
break;
case DragEvent.ACTION_DRAG_ENDED:
views.setVisibility(View.VISIBLE);
break;
}
return true;
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
ClipData data = ClipData.newPlainText("", "");
View.DragShadowBuilder myshadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data, myshadowBuilder, view, 0);
view.setVisibility(View.INVISIBLE);
return true;
} else {
return false;
}
}