Open nozominull opened 8 years ago
Hi, @xuyangbill Thank you for reporting.
It is a bug...
how to solve it? i just meet
Sorry, It hasn't solved yet :(
I think I found the problem.
I had two version of my code using this library in fragment style. The first version adds the pages before setting ViewPager with adapter and before setting the SmartTabLayout in the onCreateView.
The second version loads the pagerTab initially with empty pages.
The second version fails to center.
I tested adding static pages in the on createView before setting the pagerTab. The replace the contents of the adapter later when the real pages are available. The alwaysOnCenter now works.
Therefore the problem occurs when the viewPager and the SmartTabLayout is loaded with empty pages first.
call this after setViewPager fixes for me.
stl.post({ stl.requestLayout() })
Click the button(to update data),the first tab appears in the left side;When tap another tab,the new selected tab scroll to left too.
this is my code