Android: toolbar text looks black, not white.

My toolbar text, back arrow and everything goes black, but I want it to be white
How can i achieve this?
My styles.xml looks like this:

<resources> <style name="AppTheme" parent="MyMaterialTheme.Base"> </style> <style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowNoTitle">true</item> <item name="windowActionBar">false</item> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> <item name="android:windowBackground">@color/windowBackground</item> <item name="android:textColor">@color/textColorPrimary</item> <item name="android:textStyle">normal</item> </style> </resources> 

Android Manifest Snippet:

  <application android:allowBackup="true" android:icon="@mipmap/hello" android:label="@string/app_name" android:theme="@style/AppTheme" > 
+7
android android-xml android-styles android-toolbar
source share
3 answers

Define a style for your toolbar:

 <style name="AppToolbar" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> <item name="android:textColorPrimary">@android:color/white</item> <item name="android:textColorSecondary">@android:color/white</item> </style> 

Install it on the toolbar:

  <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:layout_scrollFlags="scroll|enterAlways" android:theme="@style/AppToolbar" android:minHeight="?attr/actionBarSize"/> 
+15
source share

write this answer here

To change the title bar color on a toolbar, you just need to add the android:textColorPrimary attribute to the toolbar style.

+1
source share

Try using these elements in the themes.xml or styles.xml folder in the values ​​folder or in the folders of v21 values ​​and other values.

 <style name="AppTheme" parent="Theme.AppCompat.Light"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/primaryColor</item> <item name="colorPrimaryDark">@color/primaryColor</item> <item name="colorAccent">@color/primaryColor</item> <item name="android:textColorPrimary">@android:color/white</item> <item name="android:navigationBarColor">@android:color/black</item> <item name="actionMenuTextColor">@android:color/holo_blue_dark</item> <item name="android:actionMenuTextColor">@android:color/holo_blue_dark</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:statusBarColor">@android:color/black</item> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowBackground">@android:color/white</item> <item name="android:windowContentTransitions">true</item> </style> 

Note: - remove these elements from the API level below the API level.

  <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:statusBarColor">@android:color/black</item> <item name="android:windowContentTransitions">true</item> 
+1
source share

All Articles