How to change the text color in Android Action bar
Change in your style.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
Add underneath line:
<item name="actionMenuTextColor">Your Color Here</item>
<item name="textColorPrimary">Your Color Here</item>
</style>
Hope it helps.
How to change Actionbar text color using Material Design?
Using the ActionBar
in your theme you can use:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="actionBarTheme">@style/ThemeOverlay.Actionbar</item>
</style>
<style name="ThemeOverlay.Actionbar" parent="ThemeOverlay.MaterialComponents.Dark.ActionBar" >
<item name="android:textColorPrimary">@color/....</item>
</style>
Can't change ActionBar title text color
I am using this and it works for me
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="titleTextColor">@android:color/white</item>
<item name="subtitleTextColor">@android:color/white</item>
</style>
Android - Change Actionbar Title Text Color
wandering around StackOverflow I found this answer which finally worked.
I report it here:
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">@style/ActionBar</item>
...
</style>
<style name="ActionBar" parent="@android:style/Widget.ActionBar">
<item name="android:titleTextStyle">@style/ActionBar.Title</item>
<item name="android:subtitleTextStyle">@style/ActionBar.Subtitle</item>
...
</style>
<style name="ActionBar.Title">
<item name="android:textColor">@color/my_color</item>
</style>
<style name="ActionBar.Subtitle">
<item name="android:textColor">@color/my_color</item>
</style>
I want to change title bar text color in material Components theme. Any help will be greatly appreciated
just add this to you base theme
<item name="titleTextColor">@android:color/holo_red_dark</item> //whatever color
Eg:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="titleTextColor">@android:color/holo_green_dark</item>
</style>
Change ActionBar text color after inheriting Theme.AppCompat.DayNight
Using the ActionBar in your theme you should use the actionBarStyle
attribute:
<style name="AppTheme" parent="Theme.AppCompat.DayNight">
<item name="actionBarStyle">@style/....</item>
</style>
<style name="MyActionBarStyle" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="titleTextStyle">@style/...</item>
</style>
If you are using the Toolbar
API, you can also use
<Toolbar
app:titleTextColor="@color/...."
../>
Instead with the Material Components Library and the Toolbar
API you can use:
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
<item name="toolbarStyle">@style/my_Toolbar</item>
</style>
<style name=my_Toolbar" parent="@style/Widget.MaterialComponents.Toolbar">
<item name="titleTextColor">@color/...</item>
</style>
Change the title text color in the Android ActionBar via xml
I solved my problem. The problem was that I was testing in a device with api level 14+ and I just added the style to res/values . I had to add the style in res/values-v14 too. I attach my code:
res/values/styles.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.Dbtools_style" parent="@style/Theme.AppCompat.Light">
<!-- Title Text Color -->
<item name="actionMenuTextColor">@color/white</item>
</style>
<style name="ActionBar.Solid.Dbtools_style" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
<!-- Title Text Color -->
<item name="titleTextStyle">@style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
</style>
res/values-v14/styles.xml
<style name="Theme.Dbtools_style" parent="@style/Theme.AppCompat.Light">
<item name="android:actionBarStyle">@style/ActionBar.Solid.Dbtools_style</item>
<!-- Title Text Color -->
<item name="android:actionMenuTextColor">@color/white</item>
</style>
<style name="ActionBar.Solid.Dbtools_style" parent="@style/Widget.AppCompat.Light.ActionBar.Solid">
<!-- Title Text color -->
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>
<!-- ActionBar title text -->
<style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
<!-- The textColor property is backward compatible with the Support Library -->
</style>
Change ActionBar title text color using Light.DarkActionBar theme in AppCompat 21
You can change it with actionBarStyle
attribute of theme.
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar.Solid">
<item name="titleTextStyle">@style/MyTitleTextStyle</item>
</style>
<style name="MyTitleTextStyle" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">CHANGE_COLOR_HERE</item>
</style>
Related Topics
How to Support Arabic Text in Android
"Default Activity Not Found" on Android Studio Upgrade
This App Won't Run Unless You Update Google Play Services (Via Bazaar)
How to Scale an Image in Imageview to Keep the Aspect Ratio
Different Resolution Support Android
How to Have Android Service Communicate With Activity
Why Not Use Always Android:Configchanges="Keyboardhidden|Orientation"
Android How to Adjust Layout in Full Screen Mode When Softkeyboard Is Visible
How to Resize a Bitmap in Android
Notification Bar Icon Turns White in Android 5 Lollipop
What Is Android:Weightsum in Android, and How Does It Work
Determine If the Device Is a Smartphone or Tablet
Ioexception: Read Failed, Socket Might Closed - Bluetooth on Android 4.3
Passing Android Bitmap Data Within Activity Using Intent in Android