OnPageScrolled doesn't work on Android -
i know there similiar problems on stackoverflow none of these solutions worked me. want use method onpagescrolled, have set listner, adapter etc. still doesn't react. here code : implement method via :
public class chefviewactivity extends robofragmentactivity implements viewpager.onpagechangelistener {
then :
.... pagerindicator = new pagerindicator((linearlayout) findviewbyid(r.id.pagerindicator), fragments.size()); fragmentadapter = new detailsfragmentadapter(getsupportfragmentmanager(), fragments, pagerindicator); viewpager = (viewpager) findviewbyid(r.id.pager); viewpager.setadapter(fragmentadapter); viewpager.setonpagechangelistener(pagerindicator); viewpager.setoffscreenpagelimit(5); pagerindicator.onpageselected(viewpager.getcurrentitem()); .....
the following code works me.
viewpager.setonpagechangelistener(new onpagechangelistener() { @override public void onpageselected(int arg0) { } @override public void onpagescrolled(int arg0, float arg1, int arg2) { } @override public void onpagescrollstatechanged(int arg0) { } });
Comments
Post a Comment