Changement ActionBarDrawerToggle icône android dans la barre d'outils?

J'ai une activité avec tiroir de navigation et la barre d'outils

Activité

public class MainActivity extends AppCompatActivity {
private Toolbar toolbar;
private CustomTextViewMondaRegular tvTitle;
private ListView mDrawerList;
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToggle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
tvTitle = (CustomTextViewMondaRegular) findViewById(R.id.actionTitle);
tvTitle.setText(getIntent().getStringExtra("title"));
mDrawerList.setAdapter(new NavAdapter(getApplicationContext()));
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList.setOnItemClickListener(new DrawerItemClickListener());
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,toolbar,
R.string.title_activity_main, R.string.title_activity_main) {
@Override
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
invalidateOptionsMenu(); //creates call to onPrepareOptionsMenu()
}
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu();
//creates call to onPrepareOptionsMenu()
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
if (savedInstanceState == null) {
}
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
mDrawerToggle.syncState();
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
mDrawerToggle.onConfigurationChanged(newConfig);
}
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView parent, View view, int position, long id) {
Logger.e("pos", position + "");
}
}

}

Activité XML

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.vf.MainActivity">
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/tool_bar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@android:color/white"
android:elevation="3dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/MyDarkToolbarStyle">
<TextView
android:id="@+id/actionTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:layout_marginRight="5dp"
android:drawableEnd="@drawable/logo"
android:drawableRight="@drawable/logo"
android:gravity="center"
android:text="XXXXXX"
android:textColor="#000000"
android:textSize="18sp" />
</android.support.v7.widget.Toolbar>
</FrameLayout>
<ListView
android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:choiceMode="singleChoice"
android:divider="#D8D8D8" />

La bascule icône affiche l'icône par défaut. J'ai besoin de changer l'icône. Comment puis-je le faire?

InformationsquelleAutor WISHY | 2015-07-06