android - 在 TabHost 中有小写标题

标签 android android-tabhost

我已经从下面的代码中实现了 Tabhost,默认情况下标题似乎是大写的。如何在 Tabhost 中放置小写标题?

这是我的 Tabhost 实现代码。

TabHost tabHost =getTabHost() ;

      // Tab for public
       TabHost.TabSpec publiComp = tabHost.newTabSpec("Public");
       publiComp.setIndicator("Public");
       Intent publicIntent = new Intent(this, CompliancePublic.class);
       publiComp.setContent(publicIntent);

       // Tab for private
       TabHost.TabSpec privateComp = tabHost.newTabSpec("Private");
       privateComp.setIndicator("Private");
       Intent privateIntent = new Intent(this, CompliancePrivate.class);
       privateComp.setContent(privateIntent);

       tabHost.addTab(publiComp);
       tabHost.addTab(privateComp);

最佳答案

试试这个

mTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);

mTabHost.setup(getActivity(), getChildFragmentManager(), R.id.realtabcontent);

View tabIndicatorToday = LayoutInflater.from(getActivity()).inflate(R.layout.tab_indicator, mTabHost.getTabWidget(), false);
        ((TextView) tabIndicatorToday.findViewById(R.id.tv_tab_txt)).setText(getResources().getString(R.string.text));

mTabHost.addTab(mTabHost.newTabSpec(getResources().getString(R.string.text)).setIndicator(tabIndicatorToday), Fragment.class, null);

并为您的 TextView 赋予您自己的样式

关于android - 在 TabHost 中有小写标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40929155/

相关文章:

java - Android应用程序的新闻部分

android - 在xml文件中添加标签栏

android - 以编程方式切换标签android

android - 自定义 Android TabHost 慢 fragment

android - 我可以以 root 身份启动 android intent 吗?

php - 如何使用Post方法从android类执行php文件

android - 如何在android的启动画面中播放音频

java - 从图像 URI 获取 base64 字符串

android - 无法创建选项卡内容,因为在 Android Eclipse 中找不到 ID 为 -1 的 View XML 错误?

android - OnActivityResult 在 TabActivityGroup 中不起作用?