How to change text color of ActionBar in Android 5.0 Lollipop?

How to change text color from ActionBar in Android Lollipop to white from black?

This is my current style.

 <style name="AppCustomTheme" parent="@style/Theme.AppCompat.Light"> <!-- colorPrimary is used for the default action bar background --> <item name="colorPrimary">@color/orange_bar</item> </style> 
+6
source share
3 answers

I read more and found that you need to add this tag to change the default ActionBar color in Android Lollipop.

  <!--textColorPrimary is used to change the text color of the default action bar--> <item name="android:textColorPrimary">#FFFFFF</item> 
+5
source

Use @style/Theme.AppCompat.Light.DarkActionBar to change the color of the text and many other attributes to better fit with the dark action bar.

+7
source

Tested on 5.0 Lollipop and 4.4 KitKat

 <style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- To change action bar text color --> <item name="android:textColorPrimary">#123</item> <!-- This has to be here to make it work; let me know if you know why --> <item name="actionBarTheme">@style/ThemeOverlay.AppCompat.ActionBar</item> </style> 
+2
source

Source: https://habr.com/ru/post/977159/


All Articles