TabLayout tab selection

前端 未结 25 1458
情深已故
情深已故 2020-11-29 17:15

How should I select a tab in TabLayout programmatically?

 TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
 tabLayout.setupWithViewPager(viewPager         


        
25条回答
  •  独厮守ぢ
    2020-11-29 17:38

    Just set viewPager.setCurrentItem(index) and the associated TabLayout would select the respective tab.

提交回复
热议问题