1

I'm using Appcompat in the App.

How can I change the text color of the ActionBar? I've tried a personalized theme but it doesn't work

<style name="AppTheme" parent="Theme.AppCompat.Light">        
    <item name="android:actionBarStyle">@style/MyActionBar</item>
</style>

<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
        <item name="android:textColor">#000080</item>
</style>
Roberto Aureli
  • 1,428
  • 2
  • 12
  • 23

2 Answers2

0

Since the Toolbar is like any other view, you can change the way you want your text to look like particularly the title text:

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay">

        <TextView
            android:id="@+id/custom_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="16sp"
            android:textColor="@color/colorRed"
            android:text="@string/title_activity_mainr"/>
    </android.support.v7.widget.Toolbar>

</android.support.design.widget.AppBarLayout>

This should help change the text color.

In fact, you can change the position of the title text as you wish!

Happy coding!

Eenvincible
  • 5,641
  • 2
  • 27
  • 46
0

I don't have any problem to do this alone if it's the only way to resolve the problem, i didn't want to change because of my lazyness

Roberto Aureli
  • 1,428
  • 2
  • 12
  • 23