android - How to change Drag shadow after start? -
hi know question has been answered in here, problem don't know how use imagedragshadowbuilder , how start drag can change shadow drag(ball). have different shapes different colors , change drawable depending on event (action_drag_entered). have shape imageview ball onlongclicklistener.
r.drawable.mood_ball.xml:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval"> <solid android:color="@color/colorprimarydark"/> <size android:width="60dp" android:height="60dp"/> </shape>
i have on view.ondraglistener , change ball depending on event action_drag_entered: unfortunately not with:
imagedragshadowbuilder.fromresource(context context,r.drawable.mood_ball_red.xml);
(start r.drawable.mood_ball , change r.drawable.mood_ball_red ) try fire event like here did not work. how can change drag shadow depending on action_drag_entered:
the drag start long click on ball
view.dragshadowbuilder shadowbuilder; private class onclicklistener implements view.onlongclicklistener { @override public boolean onlongclick(view view) { clipdata data = clipdata.newplaintext("simple text", "text"); shadowbuilder = new view.dragshadowbuilder(view); view.startdrag(data,shadowbuilder,null,0); view.setvisibility(view.invisible); return true; } }
and linearlayout looking like:
Comments
Post a Comment