I am using ActionBarSherlock and have an ActionBar with navigation tabs in it. I want the tabs to auto-size based on the size of the text in them, but there seems to be a style
Override this class in project ActionBarSherlock ./ActionbarSherlock/src/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.java
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
Re-measure if we went beyond our maximum size.
if (mParent.mMaxTabWidth > 0 && getMeasuredWidth() > mParent.mMaxTabWidth) {
//do nothing , override by me for ActionBarTabs not rezize never
}
}
Original code from
@Override
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// Re-measure if we went beyond our maximum size.
if (mParent.mMaxTabWidth > 0 && getMeasuredWidth() > mParent.mMaxTabWidth) {
super.onMeasure(MeasureSpec.makeMeasureSpec(mParent.mMaxTabWidth, MeasureSpec.EXACTLY),
heightMeasureSpec);
}
}
When run , that code in android 2.3.3 works fine when my Tabs not broken line, but in android 4.4 not works.