So I have TabLayout with two TabItems in it. I want the text inside the TabLayout to increase, and when I swipe from the first tab to another I want it to animate it like the text inside first tab gets smaller and the size of text inside the other tab increases.
my TabLayout listener:
final TabLayout tablayout=(TabLayout)rootview.findViewById(R.id.TabLayout);
final ViewPager viewPager=rootview.findViewById(R.id.MainActivityPager);
final TabLayoutAdapter tabLayoutAdapter=new TabLayoutAdapter(getContext(),getChildFragmentManager(),2);
viewPager.setAdapter(tabLayoutAdapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tablayout));
tablayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
tabLayoutAdapter.notifyDataSetChanged();
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
An example: https://imgur.com/gallery/OYz2Z1h