版权声明:本文为博主原创文章,未经博主允许不得转载。
https://blog.csdn.net/weixin_40790006/article/details/79933503
// RadioGroup group.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup radioGroup, int i) { switch (radioGroup.getCheckedRadioButtonId()){ case R.id.rb_all: viewPager.setCurrentItem(0); break; case R.id.rb_1: viewPager.setCurrentItem(1); break; case R.id.rb_2: viewPager.setCurrentItem(2); break; case R.id.rb_3: viewPager.setCurrentItem(3); break; case R.id.rb_4: viewPager.setCurrentItem(4); break; case R.id.rb_5: viewPager.setCurrentItem(5); break; } } }); // ViewPager viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { switch (position){ case 0: group.check(R.id.rb_all); break; case 1: group.check(R.id.rb_1); break; case 2: group.check(R.id.rb_2); setListData(new FragmentOne(),"3"); // listView刷新?? break; case 3: group.check(R.id.rb_3); setListData(new FragmentOne(),"6"); break; case 4: group.check(R.id.rb_4); setListData(new FragmentOne(),"8"); break; case 5: group.check(R.id.rb_5); break; } } @Override public void onPageScrollStateChanged(int state) { } });