为了自定义我的操作栏,我在xml中使用下面的代码:
<style name="CustomActionbarTheme" parent="@style/Theme.AppCompat.Light">
<item name="actionBarTabStyle">@style/customTab</item>
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="background">@drawable/title_bar</item>
</style>
<style name="customTab" parent="@style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">@drawable/tab_bg_selector</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我使用api 10级没有问题但是当我在更高的api设备中运行我的代码时,操作栏处于默认主题.我在我的项目中使用支持库v7.