I have been adding style to my Actionbar and everythings been working well, until I try to change the Actionbar title. When I add style to the Actionbar's title the title just disappears. The Actionbar is still there, but there is simply no title.
This is my Actionbar style code
<style name="Theme.TabTheme" parent="Theme.AppCompat">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/dark_primary</item>
<item name="colorAccent">@color/accent</item>
<item name="android:windowNoTitle">false</item>
<item name="android:windowActionBar">true</item>
<item name="android:actionBarStyle">@style/Theme.TabTheme.MyActionBar</item>
<item name="android:actionBarTabStyle">@style/MyActionBarTabs</item>
</style>
<style name="Theme.TabTheme.MyActionBar" parent="ThemeOverlay.AppCompat.ActionBar">
<item name="android:background">@color/primary</item>
<item name="android:height">50dp</item>
<item name="android:titleTextStyle">
@style/Theme.TabTheme.MyActionBar.TitleTextStyle
</item>
</style>
<style name="Theme.TabTheme.MyActionBar.TitleTextStyle"
parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/primary_text</item>
<item name="android:text">@string/app_name</item>
<item name="android:textSize">15sp</item>
</style>
<!-- ActionBar tabs styles -->
<style name="MyActionBarTabs" parent="Theme.AppCompat">
<!-- tab indicator -->
<item name="android:background">@drawable/actionbar_tab_indicator</item>
</style>
Why is adding style to the Actionbar Title making the title disappear?
Try adding displayOptions
like this to your Action Bar style:
<item name="android:displayOptions">showHome|useLogo|showTitle</item>
or
<item name="displayOptions">showHome|useLogo|showTitle</item>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With