style.xml
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<item name="android:homeAsUpIndicator">@drawable/ic_back</item>
<item name="homeAsUpIndicator">@drawable/ic_back</item>
</style>
MainActivity.java
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
actionBar.setIcon(new ColorDrawable(getResources().getColor(android.R.color.transparent)));
View actionBarView = inflator.inflate(R.layout.custom_title, null);
actionBar.setCustomView(actionBarView);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.drawable.ic_action_nav_menu, //nav menu toggle icon
R.string.app_name, // nav drawer open - description for accessibility
R.string.app_name // nav drawer close - description for accessibility
) {
public void onDrawerClosed(View view) {
tvTitle.setText(mTitle);
//getActionBar().setTitle(mTitle);
// calling onPrepareOptionsMenu() to show action bar icons
invalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
tvTitle.setText(mDrawerTitle);
//getActionBar().setTitle(mDrawerTitle);
// calling onPrepareOptionsMenu() to hide action bar icons
invalidateOptionsMenu();
}
};
you can see in above image, where in black circle i want to show 3 line image rather than back symbol image.
Use android.support.v7 instead of android.support.v4 as following:
And change your mDrawerToggle to the following:
Add following codes: