Search code examples
androidandroid-text-color

Android Tab Text color


Possible Duplicate:
Android: Change Tab Text Color Programmatically

How can we change the text color in android tab.


Solution

  • You can use following code

        TabHost tabHost = getTabHost();
    for(int i=0;i<tabhost.getTabWidget().getChildCount();i++) 
            { 
                TextView tv = (TextView) tabhost.getTabWidget().getChildAt(i).findViewById(android.R.id.title); //Unselected Tabs
                tv.setTextColor(Color.parseColor("#ffffff"));
            } 
            TextView tv = (TextView) tabhost.getCurrentTabView().findViewById(android.R.id.title); //for Selected Tab
            tv.setTextColor(Color.parseColor("#000000"))