I have a problem with .setDividerDrawable() only working in versions lower than Ice Cream Sandwich. When I run the emulator the tabs show perfectly, but no divider. When emu
I had the same problem, I finally ended up adding the separators manually. Adding ImageView between the tabs..
public class MyTabApp extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView divider = new ImageView(this);
divider.setImageResource(R.drawable.tab_seperator);
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
intent = new Intent().setClass(this, Page1.class);
spec = tabHost.newTabSpec("page1").setIndicator(getLayoutInflater().inflate(R.layout.tab1, null))
.setContent(intent);
tabHost.addTab(spec);
tabHost.getTabWidget().addView(divider, LayoutParams.WRAP_CONTENT, LayoutParams.FILL_PARENT);
intent = new Intent().setClass(this, Page2.class);
spec = tabHost.newTabSpec("page2").setIndicator(getLayoutInflater().inflate(R.layout.tab2, null))
.setContent(intent);
tabHost.addTab(spec);
}
}
you can try this code!
if(Build.VERSION.SDK_INT >= 11)
mTabHost.getTabWidget().setShowDividers(TabWidget.SHOW_DIVIDER_MIDDLE);
This behavior seems to be a default behavior in ICS tab themes and needs a work around. Take a look at this answer, specifically the one given by @Janusz, the OP.