Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Support Library 23.2.0 causing Toolbar arrow to be black

I recently updated my Android Support Library Yesterday to version 23.2.0

and all of a sudden all pre Lolipop devices changed the colors of the back arrow, hamburger and (three dots menu) to black. When they where always white.

Lollipop devices seem to be fine.

here is my style.xml which was not edited at all between updates.

<?xml version="1.0" encoding="utf-8"?>
<resources>    
    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">@color/primaryColor</item>
        <item name="colorPrimaryDark">@color/primaryColorDark</item>
        <item name="colorAccent">@color/accentColor</item>
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppTheme.Base">
    </style> 

    <!-- Theme to customise the tool bar -->
    <style name="MyCustomToolBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
    <item name="textColorPrimary">@color/textColorWhite</item>
    <!-- Added this now to test, still nothing --!> 
    <item name="colorControlNormal">@color/textColorWhite</item>

    </style>

    <style name="MyApp.MyCustomToolBarStyle" parent="@style/Widget.AppCompat.Light.ActionBar">
        <!--to add-->
    </style>
</resources>

and then here is my toolbar layout

<?xml version="1.0" encoding="utf-8"?>
<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_width="match_parent"
    android:layout_height="@dimen/toolbar_height"
    android:background="@color/primaryColor"
    app:theme="@style/MyCustomToolBarTheme"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Dark">
</android.support.v7.widget.Toolbar>
like image 408
Zapnologica Avatar asked Mar 01 '16 11:03

Zapnologica


1 Answers

This is an AppCompat bug. To fix this, update the gradle to use vector drawables:

// Gradle Plugin 2.0+  
android {  
    defaultConfig {  
         vectorDrawables.useSupportLibrary = true  
    }  
}

Earlier gradle:

// Gradle Plugin 1.5  
android {  
  defaultConfig {  
    generatedDensities = []  
 }  

 // This is handled for you by the 2.0+ Gradle Plugin  
 aaptOptions {  
   additionalParameters "--no-version-vectors"  
 }  
}  

Edit: You no longer need to set the flags according to Android blog. This has been fixed in 23.2.1.

For AppCompat users, the flags for enabling support vector drawables described in the 23.2 blog post are no longer required for usage of AppCompat. However, you can still take advantage of the app:srcCompat attribute if you wish to use support vector drawables for your own resources.

Solution now: Update your support library to use 23.2.1 or above as follows:

dependencies {
    compile 'com.android.support:appcompat-v7:23.2.1'
}
like image 169
Yogesh Umesh Vaity Avatar answered Oct 06 '22 01:10

Yogesh Umesh Vaity