Android – how to change the default color to tab host

I use the 2.2 SDK version. I use tabhost to display activities in tag view format. When I install the application on my phone (version 2.2.1), the tag host color has changed to yellow. Even if I give tabhost any color. I don't know why the color has changed. When I run in the simulator, it displays the same application and it displays the default color (i.e.) Gray and black. Anyone can face and solve this problem. Please guide me. The code here

`

    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)));`

resolvent:

In the default Android tab bar, the color will be gray, and you can easily change the color of the tab bar

Use the following line of code to change the color of the tab

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

For further reference, see here

If you are looking for iPhone tabs, you can refer to http://bakhtiyor.com/2009/10/iphonish-tabs/

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>