0
使用Google的SlidingTabLayout如何以編程方式更改選定的選項卡?如何以編程方式設置選定的選項卡SlidingTabLayout
使用Google的SlidingTabLayout如何以編程方式更改選定的選項卡?如何以編程方式設置選定的選項卡SlidingTabLayout
@Bind(R.id.pager) ViewPager mViewPager;
@Bind(R.id.tabs) SlidingTabLayout tabs;
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_team_details);
ButterKnife.bind(this);
//get this value from savedInstanceState
int tabThatNeedsToBeSelected = 3;
myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(),params);
mViewPager.setAdapter(myFragmentPagerAdapter);
tabs.setViewPager(mViewPager);
mViewPager.setCurrentItem(tabThatNeedsToBeSelected);
}
我在這裏回答了這個問題: http://stackoverflow.com/a/29582101/1869367 – EZDsIt 2015-04-11 19:32:22