如何在 SetIndicator 视图中设置文本颜色?
下面是我的 TabView 活动代码。有人知道如何在 TabView 的 SetIndicator 视图中设置 TextColor 吗?
public class TabView extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res=getResources();
TabHost tabhost=getTabHost();
TabHost.TabSpec restab;
Intent intent;
intent=new Intent().setClass(this, Home.class);
restab=tabhost.newTabSpec("Home").setIndicator("Home",res.getDrawable(R.drawable.home)).setContent(intent);
tabhost.addTab(restab);
intent=new Intent().setClass(this, Search.class);
restab=tabhost.newTabSpec("Search").setIndicator("Search",res.getDrawable(R.drawable.search_icon1)).setContent(intent);
tabhost.addTab(restab);
intent=new Intent().setClass(this, Back.class);
restab=tabhost.newTabSpec("Back").setIndicator("Back",res.getDrawable(R.drawable.back_icon)).setContent(intent);
tabhost.addTab(restab);
for(int i=0;i<tabhost.getTabWidget().getChildCount();i++)
{
tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#CCCCCC"));
}
}
}
Below is my Code For the TabView Activity. Any one have idea how to set TextColor in the my SetIndicator view for TabView?
public class TabView extends TabActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Resources res=getResources();
TabHost tabhost=getTabHost();
TabHost.TabSpec restab;
Intent intent;
intent=new Intent().setClass(this, Home.class);
restab=tabhost.newTabSpec("Home").setIndicator("Home",res.getDrawable(R.drawable.home)).setContent(intent);
tabhost.addTab(restab);
intent=new Intent().setClass(this, Search.class);
restab=tabhost.newTabSpec("Search").setIndicator("Search",res.getDrawable(R.drawable.search_icon1)).setContent(intent);
tabhost.addTab(restab);
intent=new Intent().setClass(this, Back.class);
restab=tabhost.newTabSpec("Back").setIndicator("Back",res.getDrawable(R.drawable.back_icon)).setContent(intent);
tabhost.addTab(restab);
for(int i=0;i<tabhost.getTabWidget().getChildCount();i++)
{
tabhost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#CCCCCC"));
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
个人可以使用TextView。像这样:
You can use TextView for individual. Like this: