Change text and background color in title bar (Android)?

I am creating an Android application and I am trying to change the title background and text color.

In AndroidManifest.xml:

<application ... android:theme="@style/ThemeSelector" > 

In styles.xml:

 <style name="ThemeSelector" parent="android:Theme.Light"> <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item> </style> <style name="WindowTitleBackground"> <item name="android:background">@color/titlebackgroundcolor</item> <item name="android:textColor">@color/titletextcolor</item> </style> 

Using this code, I manage to change the background color, but not the color of the text.

Can you explain why this code is not working?

thanks

+4
source share
1 answer
 <style name="ThemeSelector" parent="android:Theme.Light"> <item name="android:windowTitleBackgroundStyle">@style/WindowTitleBackground</item> <item name="android:windowTitleStyle">@style/CustomWindowTitle</item> </style> <style name="WindowTitleBackground"> <item name="android:background">@color/titlebackgroundcolor</item> </style> <style name="CustomWindowTitle" parent="WindowTitle"> <item name="android:textAppearance">@style/CustomWindowTitleText</item> </style> <style name="CustomWindowTitleText" parent="android:TextAppearance"> <item name="android:textColor">@color/titletextcolor</item> </style> <style name="WindowTitle"> <item name="android:singleLine">true</item> <item name="android:textAppearance">@style/CustomWindowTitleText</item> <item name="android:shadowColor">#BB000000</item> <item name="android:shadowRadius">2.75</item> </style> 
+2
source

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


All Articles