android - Drag view from RecyclerView Adapter to view inside container Fragment -
i have recyclerview
inside fragment
, want drag row recycler
adapter
, drop view in container fragment
- "the recycler
, view
inside same fragment, tried lot of codes stack , youtube, used code achieve drag , drop works in views out side adapter only.
private class choicetouchlistener implements view.ontouchlistener { rownewsrecylcerholder holder; public choicetouchlistener(rownewsrecylcerholder holder) { this.holder = holder; } @override public boolean ontouch(view v, motionevent event) { final int x = (int) event.getrawx(); final int y = (int) event.getrawy(); switch (event.getaction() & motionevent.action_mask) { case motionevent.action_down: linearlayout.layoutparams lparams = (linearlayout.layoutparams) v.getlayoutparams(); _xdelta = x - lparams.leftmargin; _ydelta = y - lparams.rightmargin; break; case motionevent.action_up: break; case motionevent.action_pointer_down: break; case motionevent.action_pointer_up: break; case motionevent.action_move: linearlayout.layoutparams layoutparams = (linearlayout.layoutparams) v.getlayoutparams(); layoutparams.leftmargin = x - _xdelta; layoutparams.topmargin = y - _ydelta; layoutparams.rightmargin = 250; layoutparams.bottommargin = 250; v.setlayoutparams(layoutparams); break; } holder.getrowcardviewcontent().invalidate(); return true; } }
Comments
Post a Comment