Open magicgoose opened 10 years ago
Can confirm this bug. Happened to me on my Nexus 4, in portrait mode.
With shouldExpand set to false the text is not clipped.
Im also seeing this on a Nexus 4 with 4 tabs - im only getting when i switch from all upper case to lower case - presumably the width is shortened just enough for the custom view layout to think that they can all fit on one screen without scrolling
Same problem here! Do you guys have any news?
If you call mPagerSlidingTabStrip.setTabPaddingLeftRight(0);
the text will fill the tab instead of clipping.
Same problem here! It looks like a LinearLayout measure bug,Is any one fixed this bug?
@OnlyInAmerica 's tip of calling .setTabPaddingLeftRight(0);
fixed it for me.
I created a minihack based on the suggested bug fix found here :
LinearLayout tabsContainer = (LinearLayout) tabStrip.getChildAt(0);
for (int i=0; i < tabsContainer.getChildCount(); i++) {
TextView tab = (TextView)tabsContainer.getChildAt(i);
tab.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
}
You might also want to add left and right padding to the tabs while you are at it. in which case the code would be (I added an 8px padding):
LinearLayout tabsContainer = (LinearLayout) tabStrip.getChildAt(0);
for (int i=0; i < tabsContainer.getChildCount(); i++) {
TextView tab = (TextView)tabsContainer.getChildAt(i);
tab.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
tab.setPadding(8,0,8,0);
}
Tested on Sony Xperia L. When in landscape mode, and there are 4 tabs with different text length (about 1-2 words), the library may decide that they all can fit in the screen and the tab with the longest text inside gets clipped text.