问题描述
我想让用户能够在我的应用程序中从一个活动拖动到另一个活动,但是未检测到drop事件
在第一个活动中开始拖动操作:
public boolean onItemLongClick(AdapterView<?> aParent,View aView,int aPos,long aID) {
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(aView);
Intent intent = new Intent();
intent.putExtra("Phase","Phase");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
aView.startDragAndDrop(ClipData.newIntent(DRAG_N_DROP_DESCRIPTION,intent),shadowBuilder,null,0);
} else {
aView.startDrag(ClipData.newIntent(DRAG_N_DROP_DESCRIPTION,0);
}
startSecondActivity();
finish();
return true;
}
在第二个活动中接收放置操作
public boolean onDrag(View aView,DragEvent aEvent) {
switch (aEvent.getAction()) {
case DragEvent.ACTION_DRAG_STARTED:
This is not called on Android 22+
break;
case DragEvent.ACTION_DROP:
This is not called on Android 22+
break;
}
return true;
}
该解决方案将获得50点奖励。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)