I wants to change the action bar title color to white in android . and i am using theme in values Theme.AppCompat.Light
and values-14 Theme.AppCompat.Light.DarkActionBar
I have tried so far
in values folder :
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:textColor">@android:color/white</item>
</style>
and values -14 folder
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarStyle">@style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="@style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:textColor">@android:color/white</item>
</style>
but ActionBar title color is not changing.
You can define the color of the ActionBar (and other stuff) by creating a custom Style: Simply edit the res/values/styles. xml file of your Android project. Then set "MyCustomTheme" as the Theme of your Activity that contains the ActionBar.
Customize the Text Color To modify the color of text in the action bar, you need to override separate properties for each text element: Action bar title: Create a custom style that specifies the textColorproperty and specify that style for the titleTextStyleproperty in your custom actionBarStyle.
If you want to style the action bar to better fit your product brand, you can easily do so using Android's style and themeresources. Android includes a few built-in activity themes that include "dark" or "light" action bar styles. You can also extend these themes to further customize the look for your action bar.
You can also use a dark action bar while the rest of the activity uses the light color scheme by declaring the Theme.Holo.Light.DarkActionBartheme. When using the Support Library, you must instead use the Theme.AppCompatthemes: Theme.AppCompatfor the "dark" theme.
Apply a style as a theme. You can create a theme the same way you create styles. The difference is how you apply it: instead of applying a style with the style attribute on a view, you apply a theme with the android:theme attribute on either the <application> tag or an <activity> tag in the AndroidManifest.xml file.
You can specify the background color of the ActionBar
by using the colorPrimary
attribute; something like the following:
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">@android:color/white</item>
</style>
The above is a special tag created for AppCompat
; you will notice that the android:
namespace is omitted.
If you are using Theme.AppCompat.Light.NoActionBar do
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="@color/background_material_dark"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With