I'm looking for a way to display the hamburger icon whitout using the Drawer/DrawerToggle and use the default icon included in Android
By setting getSupportActionBar().setDisplayHomeAsUpEnabled(true);
it display the back arrow but not the hambuerger. Other post on Stackoverflow (like this or this) use the DrawerLayout or a custom drawable. I cannot find the vector or png for the hamburger icon on the Android source.
Do you know how can I find the original hamburger icon in android/support library? (or how to displayed it)
Note: Vector and png can be found on google.com/design website : http://www.google.com/design/spec/resources/sticker-sheets-icons.html#
In my activity
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(LOG_TAG, "navigation clicked");
}
});
Layout file
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar"/>
Styles.xml
<!-- Base application theme. -->
<style name="Theme.AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primaryDef</item>
<item name="colorPrimaryDark">@color/primaryDarkDef</item>
<item name="colorAccent">@color/primaryDef</item>
<!-- Remove the actionbar shadow-->
<item name="android:windowContentOverlay">@null</item>
</style>
If you want to use the same drawer as lollipop then let me tell you that's not a static image. That image is drawn in real time by a class called DrawerArrowDrawableToggle
. So there is no "hamburger" icon for that.
However if you want the hamburger icon with no animation you can find it here: