Icon color - Android Toolbar

4

How do I leave the color of the icon in API's smaller than 21, also white? At 21 it works ok, but below as for example 16, it turns black.

I did it this way:

Toolbar

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

Style

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>


<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

    
asked by anonymous 22.03.2016 / 17:45

1 answer

7

I decided following the two links below:

I added the following information in build.gradle:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId ""
        minSdkVersion 15
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
        // Stops the Gradle plugin’s automatic rasterization of vectors
        **generatedDensities = []**
    }
    // Flag to tell aapt to keep the attribute ids around
    aaptOptions {
        **additionalParameters "--no-version-vectors"**
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

I'm using the version of AppCompat v23.2.0, so to allow vector drawables I used the settings above marked with ** in gradle file and resolved.

For those of you who are using Gradle 2.0+, this involves adding the vectorDrawables.useSupportLibrary = true line to your DefaultConfig in the build.gradle file.

    
22.03.2016 / 21:14