Customizing TabWidget in SDK 1.5, API 3

Posted by Dylan McClung on Stack Overflow See other posts from Stack Overflow or by Dylan McClung
Published on 2010-06-05T16:08:26Z Indexed on 2010/06/05 16:12 UTC
Read the original article Hit count: 199

Filed under:
|
|

I'm aware that API 3 doesn't allow a view to be set for a tab, but I still need to modify the TextView displayed as the indicator. I'd also like to change the Drawable for the tab, but I don't see a way to do it without a custom tab view as allowed in 1.6, API 4.

Working with this generic example below, is there way to retrieve the TextView and modify its properties or change the drawable?

       TabHost tabHost = getTabHost();
       TabHost.TabSpec spec;

       spec = tabHost.newTabSpec("nearby")
                      .setIndicator("Nearby Activity")
                      .setContent(R.id.nearby_list);                
       tabHost.addTab(spec);        

       spec = tabHost.newTabSpec("friends")
                  .setIndicator("Friends & Favorites")
                      .setContent(R.id.friends_list);
       tabHost.addTab(spec);        

       tabHost.setCurrentTabByTag("nearby");

Thanks for any help.

© Stack Overflow or respective owner

Related posts about java

Related posts about android