在tabhost上更改字符串的文本大小

时间:2013-01-26 17:45:53

标签: android android-tabhost text-size

我想更改uyari_str的文本大小,但我不能。我的代码是:

tabHost.addTab(spec);     
    view = new MyView(this, R.drawable.res_tab_uyar);

    spec = tabHost.newTabSpec("uyar").setIndicator(buildIndicator(R.string.uyari_str)).setContent(new TabHost.TabContentFactory(){

        @Override
        public View createTabContent(String tag) {
            return tv;
        }       
    });

1 个答案:

答案 0 :(得分:0)

例如,您的tabhost包含相对布局中的4个项目。

毕竟,您可以使用getTabWidget().getTabCount()来获取标签计数..

for (int i = 0; i < 4; i++) {
    RelativeLayout rl = (RelativeLayout) tabHost.getTabWidget().getChildAt(i);
    TextView textView = (TextView) rl.getChildAt(1);

    textView.setTextSize(15); // for example.
    }

您可以使用此代码或类似的内容。 :)

最好的问候。