Reputation: 10876
hello i am using AppCompat v7
for Navigation drawer. i required to change hamburger menu icon with no animation.
i gone through style of DrawerArrowToggle
and found this
<style name="Base.Widget.AppCompat.DrawerArrowToggle" parent="">
<item name="color">?android:attr/textColorSecondary</item>
<item name="thickness">2dp</item>
<item name="barSize">18dp</item>
<item name="gapBetweenBars">3dp</item>
<item name="topBottomBarArrowSize">11.31dp</item>
<item name="middleBarArrowSize">16dp</item>
<item name="drawableSize">24dp</item>
<item name="spinBars">true</item>
</style>
and there is no drawable attribute to set custom icon. so is there way to change icon?
i know we can disable drawerToggle
and set custom image in toolbar and maintain open and close state.
Upvotes: 0
Views: 1545
Reputation: 10279
I think currently this is not possible if you use v7 ActionBarDrawerToggle. This class has only a package-local constructor which allows you to change the burger-menu / slider.
/**
* In the future, we can make this constructor public if we want to let developers customize the animation.
*/
<T extends Drawable & DrawerToggle> ActionBarDrawerToggle(Activity activity, Toolbar toolbar, DrawerLayout drawerLayout, T slider, @StringRes int openDrawerContentDescRes, @StringRes int closeDrawerContentDescRes) {
// some code
if (slider == null) {
mSlider = new DrawerArrowDrawableToggle(activity,
mActivityImpl.getActionBarThemedContext());
} else {
mSlider = slider;
}
}
As a (bad) workaround I would suggest you to continue using the old v4 ActionBarDrawerToggle, which allows the customization of the burger icons.
Please notice that you can customize the default animation-slider as described in this SO-comment: https://stackoverflow.com/a/26447144/2960788
Furthermore you could tint the slider by setting
<item name="colorControlNormal">#ccffffff</item>
in your toolbar's theme.
Upvotes: 1