【问题标题】:Change the text size of string on tabhost更改 tabhost 上字符串的文本大小
【发布时间】:2013-01-10 11:21:48
【问题描述】:

我想更改 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;
        }       
    });

【问题讨论】:

  • 你试过使用 Html.fromHtml 吗?
  • 你试过了吗,因为我们还在strings.xml文件中嵌入了html
  • 如何更改?我的字符串是:警告
  • 尝试作为 buildIndicator(Html.fromHtml(""+R.string.uyari_str+"")
  • 不工作。 Sting 未显示在屏幕上

标签: android android-tabhost text-size


【解决方案1】:

例如,您的 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.
    }

您可以使用此代码或类似的东西。 :)

最好的问候。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-01-07
    • 1970-01-01
    • 1970-01-01
    • 2021-10-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多