Reputation: 3520
I am getting back into android after taking a break from it for a while. However from reading it seems like if you use tabhost (or even actionbar) you cannot add tab icons on top of the tab text.
i.e you cant do this tabspec.setIndicator("Tab1",drawableIcon)
It will just show the text with no icon. Is there anyway you can add a tab with the icon on top of the text with the new ICS theme?
PS. I am doing fragments with tabhost. In case you were wondering if i was using tabhost the old way (with activities)
Also, I know I can make my own theme to mimick ICS but I dont want to do that.
Upvotes: 1
Views: 1337
Reputation: 1701
To get the image to show
int imageViewIndex = 1;
if (ifICS) {
imageViewIndex = 0;
}
ViewGroup idView = (ViewGroup) mTabHost.getTabWidget().getChildAt(INDEX);
ImageView imageView = (ImageView) idView.getChildAt(imageViewIndex);
imageView.setImageResource(R.drawable...);
then if you set the image View after the tabhost is made the image will be displayed
Upvotes: 1