如何更改默认的颜色为制表主机 [英] How to change default color to Tab Host

查看:137
本文介绍了如何更改默认的颜色为制表主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的2.2 SDK版本。我用TabHost显示在标签视图形式的活动。当我安装在手机(版本2.2.1)的应用中,标签主机颜色已变成黄色。连我力提供任何颜色TabHost。我不知道为什么颜色已经改变。当我运行在模拟器的同一个应用程序,它会显示默认颜色(IE)灰色和黑色。任何人都可以面对和解决这个问题请指引我。在这里,code

`

  mTab​​Host.addTab(mTabHost.newTabSpec(1)setIndicator(CLASSA)setContent(新意图(这一点,classA.class)));
    mTabHost.addTab(mTabHost.newTabSpec(二)setIndicator(CLASSB)setContent(新意图(这一点,classB.class)));
    mTabHost.addTab(mTabHost.newTabSpec(三化)setIndicator(classC)setContent(新意图(这一点,classc.class)));`
 

解决方案

在默认的Andr​​oid标签栏的颜色将是灰色,你可以很容易地改变标签栏的颜色。

使用下面的一行code键更改标签的颜色

  tabHost.getTabWidget()getChildAt(我).setBackgroundColor(Color.RED)。
要么
     。tabHost.getTabWidget()getChildAt(0).setBackgroundColor(Color.parseColor(#4E4E9C));
 

有关进一步的参考,您可以在这里参考

如果您正在寻找iphonish选项卡,你可以参考这个<一href="http://bakhtiyor.com/2009/10/iphonish-tabs/">http://bakhtiyor.com/2009/10/iphonish-tabs/

I am using 2.2 SDK version. and i used TabHost to display the activity in tab view format. when i install application in mobile phone(Version 2.2.1), the tab host color has been changed into yellow color. Even i dint give any color to TabHost. i dont know why the color has been changed. The same application when i run in emulator, it displays default color(ie) gray and black. can anyone faced and solved this issue pls guide me. Here the code

`

    mTabHost.addTab(mTabHost.newTabSpec("one").setIndicator("classA").setContent(new Intent(this, classA.class)));
    mTabHost.addTab(mTabHost.newTabSpec("two").setIndicator("classB").setContent(new Intent(this, classB.class)));
    mTabHost.addTab(mTabHost.newTabSpec("three").setIndicator("classC").setContent(new Intent(this, classc.class)));`

解决方案

In default android tab bar color will be in Grey, you can easily change the color of the tab bar.

Use the below line of code to change the color of Tab

     tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.RED);
or
     tabHost.getTabWidget().getChildAt(0).setBackgroundColor(Color.parseColor("#4E4E9C"));

For further Reference you can refer here.

If you are looking for iphonish Tabs you can refer this http://bakhtiyor.com/2009/10/iphonish-tabs/

这篇关于如何更改默认的颜色为制表主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆