java - Android: Reporting drop result: false -
i wanted programm drag , drop button wich can move want. tryed ondrag(), if want drop button message: "reporting drop result: false " dont know why. other problem shadowbuilder disappear if drop button. want convert shadow normal button if drop it.
i'll grateful, if me.
@override public boolean onlongclick(view v) { clipdata clipdata = clipdata.newplaintext("", ""); view parent = (view) v.getparent(); parent.setvisibility(view.invisible); view.dragshadowbuilder shadowbuilder = new view.dragshadowbuilder((view) v.getparent()); v.startdrag(clipdata, shadowbuilder,parent, 0); return true; } @override public boolean ondrag(view v, dragevent event) { int dragaction = event.getaction(); if (dragaction == dragevent.action_drag_started) { if (event.getclipdescription().hasmimetype(clipdescription.mimetype_text_plain)) { //returns true, when view can view of onlongclick log.e("drag start", "drag started"); } return true; } else { if (event.getaction() == dragevent.action_drop){ v.setvisibility(view.visible); } return true; }
it not enough override ondrag method, please follow stepsdescribed in official example on android developers: https://developer.android.com/guide/topics/ui/drag-drop.html
you need set drag listener, superclass of view can override ondrag!?
Comments
Post a Comment