Hello I am trying to set the the ActionBar
title color to White. I tried below code but that is not working. Currently title of it showing in black color. I don't know what I am missing. I tried diferent many attempts but didn't get success, other properties are working fine like background color etc.
I am using AppCompat
library for backport.
Can anyone help me please.
style.xml
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- colorPrimary is used for the default action bar background -->
<item name="colorPrimary">@color/my_awesome_color</item>
<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">@color/my_awesome_dark_color</item>
<!-- colorAccent is used as the default value for colorControlActivated,
which is used to tint widgets -->
<item name="colorAccent">@color/accent</item>
<!-- ActionBar Text Style -->
<item name="titleTextStyle">@style/titleStyle</item>
</style>
<style name="ActionBarCompat" parent="Widget.AppCompat.ActionBar">
<item name="atitleTextStyle">@style/titleStyle</item>
</style>
<style name="titleStyle" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/action_bar_text_color</item>
</style>
</resources>
if you're using a Toolbar you can use the following code:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/it.onecalculator"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:titleTextAppearance="@style/MyActionBarTitleText" />
where MyActionBarTitleText is:
<style name="MyActionBarTitleText" parent="@style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">@color/white</item>
</style>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.