Implementing section indexer in list view android -
i want add section headers in list view in android attached image. can 1 me code. don't want implement side section indexer in contacts.image
this custim list adapter have created-
public class customlistadapter extends baseadapter { private activity mcontext; private list<string> mlist; private layoutinflater mlayoutinflater = null; public customlistadapter(activity context, list<string> list){ mcontext = context; mlist = list; mlayoutinflater = (layoutinflater)mcontext.getsystemservice(context.layout_inflater_service); } @override public int getcount() { return mlist.size(); } @override public object getitem(int pos) { return mlist.get(pos); } @override public long getitemid(int position) { return position; } @override public view getdropdownview(int position, view convertview, viewgroup parent) { return super.getdropdownview(position, convertview, parent); } @override public view getview(final int position, view convertview, viewgroup parent) { final listviewholder viewholder; if (convertview == null) { layoutinflater layoutinflater = (layoutinflater) mcontext.getsystemservice(context.layout_inflater_service); convertview = layoutinflater.inflate(r.layout.players_name_with_options, parent, false); viewholder = new listviewholder(convertview); convertview.settag(viewholder); } else { viewholder = (listviewholder) convertview.gettag(); } // setting name of player on text view viewholder.textview.settext(mlist.get(position)); return convertview; } // class contains views variables private class listviewholder { textview textview; // constructor of class public listviewholder(view item) { // initialising text view , spinner textview = (textview) item.findviewbyid(r.id.list_textview); } } }
i initializing arrayadapter
, adding names of players. want when ever name added section header created , player's name should set below header image had attached.
there many library available this. hope below link figure out, need.
Comments
Post a Comment