首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何增加标签标题的字体大小

如何增加标签标题的字体大小
EN

Stack Overflow用户
提问于 2013-10-23 09:52:12
回答 3查看 1.2K关注 0票数 0

我有一个视觉选项卡与视觉图标等,我想增加字体的大小,有帮助吗?

在这里,我的守则:

代码语言:javascript
运行
复制
TabSpec vision = tabHost.newTabSpec("Vision");
        vision.setIndicator("Vision",
                getResources().getDrawable(R.drawable.visionicon));
EN

Stack Overflow用户

回答已采纳

发布于 2013-10-23 10:15:49

用于为Tabs设置自定义布局:

首先为要传递的图像和文本设计一个名为"tabs_bg"的布局。

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tabsLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical" >

<ImageView
    android:id="@+id/tabs_image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:scaleType="fitXY" />

<TextView
    android:id="@+id/tabs_tv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal" />
</LinearLayout>

接下来,您需要在TabActivity中添加此方法:

代码语言:javascript
运行
复制
/***** Method for Custom Tabs *****/
private static View createTabView(final Context context, final Drawable image, final String text) {
    View tab_view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null);
    ImageView img = (ImageView) tab_view.findViewById(R.id.tabs_image);
    img.setImageDrawable(image);
    TextView txt_text = (TextView) tab_view.findViewById(R.id.tabs_tv);
    txt_badge.setText(text);
    return tab_view;
}

接下来,在TabActivity中,您需要使用以下代码设置Tabs

代码语言:javascript
运行
复制
 TabHost.addTab(TabHost.newTabSpec("Tab1").setIndicator(createTabView(TabHost.getContext(),
            getResources().getDrawable(R.drawable.tab1_image), "Tab_Name")), Tab1.class, null);
票数 1
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19538400

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档