Tab change listener android

后端 未结 6 1548
我寻月下人不归
我寻月下人不归 2021-01-07 16:22

My HomeActivity extends AppCompatActivity that uses 2 tabs.

public class HomeActivity extends AppCompatActivity {

    private SectionsPagerAdapter mSection         


        
6条回答
  •  迷失自我
    2021-01-07 16:49

    Use the ViewPager.onPageChangeListener:

    mViewPager.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) {
    
            }
        });
    }
    

提交回复
热议问题