android - How to find the middle index of Horizontal Listview(Recycler View) -
i have horizontal listview in want find every time middle index of screen can change size. want fisheye effect on middle index of listview every time while swiping , stopping. kindly give me suggestion.
@override public void onbindviewholder(viewholder holder, final int position) { try { holder.image.setimagedrawable(cntx.getpackagemanager().getapplicationicon(apps.get(position).getappname())); log.e("tag", "position: "+position ); if(position%4==0) { holder.image.setminimumheight(250); holder.image.setminimumwidth(250); } holder.image.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { packagemanager pm = cntx.getpackagemanager(); intent launchintent = pm.getlaunchintentforpackage(apps.get(position).getappname()); cntx.startactivity(launchintent); } }); } catch (exception e) { e.printstacktrace(); } }
the listview has getfirstvisibleposition()
, getlastvisibleposition()
methods. can add these values , divide 2. result index of middle element.
Comments
Post a Comment