2012-04-02 23 views

回答

0

您是否尝试在xml中使用android:ellipsize属性或在持有文本的视图中使用 setEllipsize(TextUtils.TruncateAt)?如果视图继承自或是应该起作用的文本视图。 “如果设置,导致比视图更长的单词宽度很大,而不是在中间断开。” 也许你可以通过使用public TabHost.TabSpec setIndicator (View view)

+0

我并不是真的想要缩写文本。一个稍小的填充会很好。我试图搞乱SetIndicator(myCustomView),但到目前为止我失败了(该选项卡始终保持空白)。 – 2012-04-02 18:50:23

+0

您可以放弃Tabs al togeather,并在其上使用ViewPager和Idicator,如下例所示: https://github.com/JakeWharton/Android-ViewPagerIndicator 要了解外观如何,您可以下载“ViewPagerIndicator “来自市场,只是看到它的演示。 https://play.google.com/store/apps/details?id=com.viewpagerindicator.sample&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS52aWV3cGFnZXJpbmRpY2F0b3Iuc2FtcGxlIl0。 – erbsman 2012-04-03 07:01:09

+0

谢谢,但这不是我正在寻找的UI元素... – 2012-04-03 07:27:21

0

您可以管理这个设定一个TextView作为则tabspec,与

重写此类项目ActionBarSherlock ./ActionbarSherlock/src/com/actionbarsherlock/internal/widget/ScrollingTabContainerView.java

@Override 
public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 
    super.onMeasure(widthMeasureSpec, heightMeasureSpec); 

    if (mParent.mMaxTabWidth > 0 && getMeasuredWidth() > mParent.mMaxTabWidth) { 

     //comment this line 

     // super.onMeasure(MeasureSpec.makeMeasureSpec(mParent.mMaxTabWidth, MeasureSpec.EXACTLY),heightMeasureSpec); 

     //now do nothing , override by me for ActionBarTabs not rezize never 
     //this method manage the size tabs, if you want you can count caracters to resize the size width 
    } 
}