0

I'm trying to change ActionBar text color like this.

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="actionBarStyle">@style/MyTheme.ActionBarStyle</item>
</style>


<style name="MyTheme.ActionBarStyle" parent="@style/Widget.AppCompat.ActionBar">
    <item name="android:titleTextStyle">@style/MyTheme.ActionBar.TitleTextStyle</item>
</style>

<style name="MyTheme.ActionBar.TitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
    <item name="android:textColor">@color/white</item>
</style>

According to a lot of similar topics (another one) this should work, but none of that changes text color and also my ActionBar is becoming transparent when I try this. I can change it's text color by changing textColorPrimary in AppTheme, but it also changes a lot of stuff.

Also I'd like to see any links about how styling works in android cause it and it's hierarchy kinda confuses me

Community
  • 1
  • 1
Ariorick
  • 11
  • 3

1 Answers1

0

Why not you using ToolBar xml Like this

 <android.support.v7.widget.Toolbar
            android:id="@+id/videos_toolbar"
            style="@style/ToolBarTextStyle"
            android:layout_width="match_parent"
            android:layout_height="?android:actionBarSize"
            android:layout_alignParentTop="true"
            android:background="@color/ToolBarColor"
            android:paddingRight="@dimen/_32sdp"
            android:textAlignment="center"
            app:titleTextColor="@color/ThemeColor">
aslamhossin
  • 1,217
  • 12
  • 22