i am using viewpager and tab layout
viewPager.setAdapter(Adapter);
tablayout.setupWithViewPager(viewPager);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
int cPage;
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
cPage = position;
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
now when i swipe selected tab color is changing but when i call
viewPager.setCurrentItem(1, true);
its not changing new tab layout color . say i have 2 tabs when i am 1st it setting text color green for 1st tab and when i swipe it giving 2nd tab color green .. but when i call
viewPager.setCurrentItem(1, true);
in this my 1st tab is green not 2nd tab
https://stackoverflow.com/a/35843370/4302046
// mViewPager.setCurrentItem(position);
mTabLayout.getTabAt(position).select();