Gaetan L.
Gaetan L.

Reputation: 665

android.widget.Toolbar home button color (NOT support/v7/AppCompat toolbar)

I'm struggling to set the color of the "hamburger" icon on my android.widget.Toolbar, also most of the answers I find online apply to the support/v7 toolbar, but I'm using android.widget.Toolbar.

this is what my code looks like:

Toolbar toolbar = (Toolbar) findViewById(R.id.main_toolbar);
        setActionBar(toolbar);
        ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.string.drawer_open, R.string.drawer_closed);
        drawerLayout.addDrawerListener(drawerToggle);
        ActionBar actionBar = getActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setHomeButtonEnabled(true);
        drawerToggle.syncState();

I would like to be able to style it in my styles.xml file, is it possible? I'm using material theme, this is my current styles.xml:

<resources>
    <style
        name="AppTheme"
        parent="@android:style/Theme.Material.Light.NoActionBar">

        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:textColor">@color/textColor</item>
        <item name="iconColor">@color/iconColor</item>
    </style>

    <style
        name="SplashTheme"
        parent="AppTheme">

        <item name="android:windowBackground">@drawable/splash_screen</item>
    </style>
</resources>

Thanks for your help.

Upvotes: 0

Views: 223

Answers (1)

Aniruddh Parihar
Aniruddh Parihar

Reputation: 3104

Try creating this style in your styles.xml

<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
    <item name="color">@android:color/white</item>
</style>

And then add it to you Applications theme like so:

<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>

Upvotes: 1

Related Questions