Reputation: 179
I don't want to create any custom layout for app label, just want to change it's color to white (now it's black). How could I do that?
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="MyTheme" parent="@android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/bg_blue_solid_onclick</item>
//////CHANGE label color
</style>
</resources>
Upvotes: 8
Views: 45020
Reputation: 1
in styles.xml
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
in toolbar
android:theme="@style/AppTheme.AppBarOverlay"
Upvotes: 0
Reputation: 121
None of the previous answers worked for me, so I'm showing the one that worked in my case.
<style name="AppThemeCustom" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@android:color/black</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="actionBarStyle">@style/MyActionBar</item>
<item name="android:windowBackground">@android:color/white</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.ActionBar">
<item name="android:titleTextStyle">@style/MyTitleTextStyle</item>
<!-- Support library compatibility -->
<item name="titleTextStyle">@style/MyTitleTextStyle</item>
</style>
<style name="MyTitleTextStyle"
parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@android:color/black</item>
</style>
I wish if you find yourself in my situation this solution save your day. LOL
Upvotes: 1
Reputation: 133560
styles.xml
<style name="MyTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#FF9D21</item>
<item name="android:titleTextStyle">@style/MyActionBarTitleText</item>
</style>
<style name="MyActionBarTitleText"
parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/red</item>
</style>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red">#FF0000</color>
</resources>
For more info
https://developer.android.com/training/basics/actionbar/styling.html#CustomText
Snap
Edit : For making it bold
<style name="MyActionBarTitleText"
parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/red</item>
<item name="android:textStyle">bold</item>
</style>
Upvotes: 9
Reputation: 11978
You need to style the android:titleTextStyle
in your ActionBar.
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:titleTextStyle">@style/MyTextTitle</item>
</style>
<style name="MyTextTitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
</style>
You can see this in Android Documentation: Customize the Text Color in ActionBar
Hope this helps.
Upvotes: 0