gpt4 book ai didi

android - 在 TabHost 中有小写标题

转载 作者:太空狗 更新时间:2023-10-29 13:54:46 24 4
gpt4 key购买 nike

我已经从下面的代码中实现了 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com