Tuesday 15 March 2011

android - List view item to which scroll bar points at -



android - List view item to which scroll bar points at -

i want know listview item scrollbar pointing when click on scrollbar image, can show popup related listview item

@override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); //getwindow().requestfeature(window.feature_action_bar); setcontentview(r.layout.list); list=(listview)findviewbyid(r.id.list); adapter=new lazyadapter(this, mstrings); list.setadapter(adapter); } public view getview(int position, view convertview, viewgroup parent) { view vi=convertview; if(convertview==null) vi = inflater.inflate(r.layout.item, null); textview text=(textview)vi.findviewbyid(r.id.text);; imageview image=(imageview)vi.findviewbyid(r.id.image); text.settext("itemitemitemitemitemitemitemitemitemitemitemitemititemitemitemmitetemitemitemitemitemitememitemitemitemiitemitemitemitem "+position); imageloader.displayimage(data[position], image); homecoming vi; }

you need implement onscroll method of listview below:

yourlistview.setonscrolllistener(new onscrolllistener() { @override public void onscrollstatechanged(abslistview view, int scrollstate) { //inside method can calculate , can found current position } @override public void onscroll(abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) { //inside method can calculate , can found current position, here have firstvisibleitem , total visible item count, think using it, can calculate current position. } });

android listview position scrollbar

No comments:

Post a Comment