Android ViewPager's onPageScrollStateChanged never gets called

后端 未结 2 1372
無奈伤痛
無奈伤痛 2021-02-03 23:43

I have extended the ViewPager class and implemented onPageChangeListener. I use this ViewPager in conjunction with a CirclePageIndicator inside a SherlockFragment. The ViewPager

2条回答
  •  执念已碎
    2021-02-04 00:18

    setOnPageChangeListener is deprecated. use addOnPageChangeListener

    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    
            }
    
            @Override
            public void onPageSelected(int position) {
    
            }
    
            @Override
            public void onPageScrollStateChanged(int state) {
    
            }
        });
    

提交回复
热议问题