android - Is RecyclerView a ViewGroup? -
is recyclerview viewgroup?
as in below code, using onintercepttouchevent
used viewgroups , implementing recyclerview
, recyclerview
viewgroup
? if not viewgroup
on implementing onintercepttouchevent
, views?
i trying implement this: link here
please me this.
static class recyclertouchlistener implements recyclerview.onitemtouchlistener { private gesturedetector gesturedetector; private clicklistener clicklistener; public recyclertouchlistener(context context, final recyclerview recyclerview, final clicklistener clicklistener) { this.clicklistener = clicklistener; gesturedetector = new gesturedetector(context, new gesturedetector.simpleongesturelistener() { @override public boolean onsingletapup(motionevent e) { return true; } @override public void onlongpress(motionevent e) { view child = recyclerview.findchildviewunder(e.getx(), e.gety()); if (child != null && clicklistener != null) { clicklistener.onlongclick(child, recyclerview.getchildposition(child)); } } }); } @override public boolean onintercepttouchevent(recyclerview rv, motionevent e) { view child = rv.findchildviewunder(e.getx(), e.gety()); if (child != null && clicklistener != null && gesturedetector.ontouchevent(e)) { clicklistener.onclick(child, rv.getchildposition(child)); } return false; } @override public void ontouchevent(recyclerview rv, motionevent e) { } @override public void onrequestdisallowintercepttouchevent(boolean disallowintercept) { } }
the recyclerview class viewgroup subclass related listview , gridview classes , has been made available google through recyclerview support library older versions of android. recyclerview class requires use of view holder design pattern efficient item recycling , supports use of layoutmanager, decorator, , item animator in order make component incredibly flexible @ cost of simplicity.
wiki
Comments
Post a Comment