AndroidKun / XTabLayout

Added support to modify text size and indicator width based on the original TabLayout.
666 stars 109 forks source link

设置setupWithViewPager后,标题名字不显示了。 #8

Open NeptuneCoder opened 7 years ago

NeptuneCoder commented 7 years ago

我设置了setupWithViewPager后,指示器显示,但是标题不显示。 然后我通过如下设置: mVpProduct.setAdapter(productFragmentAdapter); tabLayout.setupWithViewPager(mVpProduct); productFragmentAdapter.notifyDataSetChanged(); tabLayout.addTab(tabLayout.newTab().setText("火爆专区")); tabLayout.addTab(tabLayout.newTab().setText("固收理财")); tabLayout.addTab(tabLayout.newTab().setText("转让专区"));

指示器的位置和标题的位置错乱!

NeptuneCoder commented 7 years ago

找到原因了!在populateFromPagerAdapter 方法中,调用了removeAllTabs()方法。 我titleName通过Adapter中的getPageTitle方法设置就没有问题了。