在TabHost中有小写标题

时间:2016-12-02 09:49:13

标签: 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);

1 个答案:

答案 0 :(得分:1)

试试这个

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

提供自己的风格