How can I change the color of tab host?

How to change default color to Tab Host

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

  • Answer:

    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 http://www.androidpeople.com/android-tabhost-tutorial-%E2%80%93-part-2. If you are looking for iphonish Tabs you can refer this http://bakhtiyor.com/2009/10/iphonish-tabs/

HariRam at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Change the min sdk version to 5.

niluka

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.