android.support.v7工具栏和DrawerLayout-如何更改汉堡图标

Tza*_*ich 1 android android-icons android-actionbar android-navigation android-toolbar

我的应用程序使用ActionBarActivity和DrawerLayout等.我想将ActionBarDrawerToggle图标更改为自定义可绘制.

在我的代码中,我使用android.support.v7.widget.Toolbar作为SupportActionBar

这是我的代码:

 toolbar.setNavigationIcon(R.drawable.lifeline_shield);
 setSupportActionBar(toolbar);
 ActionBar actionbar = getSupportActionBar();
 actionbar.setDisplayHomeAsUpEnabled(true);
 actionbar.setDisplayShowTitleEnabled(false);

mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.somestring1, R.string.somestring2) ....
Run Code Online (Sandbox Code Playgroud)

但我仍然看到汉堡图标,所以我有自己的图标打开抽屉.我怎么解决这个问题?不使用弃用的api

Čik*_*nad 7

可能的解决方法:

mDrawerToggle.setDrawerIndicatorEnabled(false);
mDrawerToggle.setHomeAsUpIndicator(yourdrawableres);
Run Code Online (Sandbox Code Playgroud)