Pages

Tuesday 31 January 2012

How to change textcolor of tab text in Android

TabHost tabs = (TabHost)findViewById(R.id.TabHost01);
        tabs.setup(getLocalActivityManager());
       
       
        TabHost.TabSpec search = tabs.newTabSpec("tag1");
        search.setContent(new Intent(this,Searchgurbani.class));
        search.setIndicator("Find Me");
        tabs.addTab(search);
       
        TabHost.TabSpec pref = tabs.newTabSpec("tag5");
        pref.setContent(new Intent(this,Preferencegurbani.class));
        pref.setIndicator("Settings");
        tabs.addTab(pref);
       
        TabHost.TabSpec favorite = tabs.newTabSpec("tag6");
        favorite.setContent(new Intent(this,Favroite.class));
        favorite.setIndicator("BookMark");
        tabs.addTab(favorite);
       
        for(int i=0;i<tabs.getTabWidget().getChildCount();i++)
        {
            TextView tv = (TextView) tabs.getTabWidget().getChildAt(i).findViewById(android.R.id.title);
            tv.setTextColor(Color.parseColor("#ffffff"));
        }

2 comments:

  1. this is right code it's working

    ReplyDelete
  2. Thank you for your answer. Still your code works like a charm.

    ReplyDelete