android - setOnScrollListener() of Expandable Listview under scrollview -
i using around 27 expandable listview(that scroll inside scrollview, not 1 has parent, child relation) inside scrollview(one visible @ time, after selecting text). want add load more on this, while user reached last item while scrolling listview. setonscrolllistener() return me last item instantly while loading data instead of scrolling. please suggest way use load more in condition.
listviewssearchresults[i].setonscrolllistener(new abslistview.onscrolllistener() { @override public void onscrollstatechanged(abslistview view, int scrollstate) { } @override public void onscroll(abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) { if (firstvisibleitem + visibleitemcount == totalitemcount && totalitemcount != 0) { //call api log.d("listview ", alphabets[finali] + " hit api"); } } } });
if want use setonscrolllistener() of expandable listview under scrollview, can't use inside scrollview, may have solution have used , fixed problem.
you may remove scrollview, , header layout above listview, , keep listview in layout file. , use headerview listview headerview.
create layout layout_headerview.xml , put header content in file,
finally set them headerview of listview,
write below code in oncreate() method.
layoutinflater layoutinflater; view headerview; layoutinflater = layoutinflater.from(this); headerview = layoutinflater.inflate(r.layout.layout_headerview, null); //add in listview listview.addheaderview(headerview); // access headerview widgets may use below, iv_overlay = (imageview) headerview.findviewbyid(r.id.iv_overlay);
Comments
Post a Comment