TabHost setBackgroundResource yields blank tabs
I'm using:
intent = new Intent().setClass(this,MoreActivityGroup.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("more").setIndicator("").setContent(intent);
tabHost.addTab(spec);
for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)
{
tabHost.getTabWidget().getChildAt(i).setBackgroundResource(R.drawable.tab_feed_unselected_mdpi);
tabHost.getTa开发者_开发知识库bWidget().getChildAt(i).invalidate();
}
But all my tabs are blank, with just a little grey box at the bottom. Why does this not work? My goal is to have complete custom tabs without any of Android's default graphics
ImageView selTab = (ImageView) tabHost.getTabWidget().getChildTabViewAt(sel).findViewById(R.id.single_tab_img);
selTab.setImageResource(selected_img[sel]);
Check this tutorial, it was very useful to me and I have 100% customed tabs: http://ondrejcermak.info/en/programovani/custom-tabs-in-android-tutorial/
精彩评论