我正在尝试在标签之间添加自定义分隔符。但它不起作用。这是我的java代码:
String tabschedule = getString(R.string.myschedule);
mTabHost = getTabHost();
intent = new Intent(this, Schedule.class);
spec = mTabHost
.newTabSpec("Schedule")
.setIndicator(tabschedule,
this.getResources().getDrawable(R.drawable.schedule))
.setContent(intent);
mTabHost.addTab(spec);
String filteration = getString(R.string.filteration);
intent = new Intent(this, Filteration.class);
spec = mTabHost
.newTabSpec("Filteration")
.setIndicator(filteration,
this.getResources().getDrawable(R.drawable.filteration))
.setContent(intent);
mTabHost.addTab(spec);
String history = getString(R.string.history);
intent = new Intent(this, MyHistory.class);
spec = mTabHost
.newTabSpec("History")
.setIndicator(history,
this.getResources().getDrawable(R.drawable.historylay))
.setContent(intent);
mTabHost.addTab(spec);
这是我的xml代码:
<style name="tabtheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:actionBarTabBarStyle">@style/customTabBar</item>
</style>
<style name="customTabBar" parent="@style/Widget.AppCompat.ActionBar.TabBar">
<item name="android:showDividers">middle</item>
<!-- give your divider here -->
<item name="android:actionBarDivider">@drawable/tabdivider</item>
<item name="android:dividerPadding">0dp</item>
</style>
任何建议都将在此提前感谢。