android - Programmatically "swipe-to-dismiss" an item in a ListView/RecyclerView? -
i need able programmatically dismiss item inside recyclerview
without user swiping (instead want dismiss item when tap button in card). lot of libraries i've seen seem support actual swipes.
i've tried using existing library , simulate motionevent
creating swipe on own programmatically, interferes horizontal-swipe listener, i'm wondering how else done, ideally recyclerview
if knows how listview
instead can try adapt that.
i've looked @ this library others inspiration can't figure out how trigger swipes programmatically instead.
use listview
or recyclerview
custom adapter, , call notifydatasetchanged
after removing item datalist:
private void removelistitem(view rowview, final int position) { animation anim = animationutils.loadanimation(this, android.r.anim.slide_out_right); anim.setduration(500); rowview.startanimation(anim); new handler().postdelayed(new runnable() { public void run() { values.remove(position); //remove current content array adapter.notifydatasetchanged(); //refresh list } }, anim.getduration()); }
Comments
Post a Comment