I am trying to add the navigation drawer in my app.. Everything is working fine But now I still got the arrow icon although I replaced it with the ic_drawer from Android? Here\'
Just add the following line inside showGlobalContextActionBar() method (NavigationDrawerFragment.java class)
actionBar.setHomeAsUpIndicator(R.drawable.ic_action_menu);
Code snippet:
private void showGlobalContextActionBar() {
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_action_menu);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setTitle(R.string.app_name);
}
try this code
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
actbardrawertoggle.syncState();
}
You'll have to use
getActionBar().setDisplayShowHomeEnabled(true);
instead of
getActionBar().setDisplayShowHomeEnabled(false);
Cheers,
Felix
EDIT: Here's how to hide the Icon via XML:
add this to your styles.xml: (Replace android:Widget.Holo.Light.ActionBar.Solid with android:Widget.Holo.ActionBar.Solid if you are using the dark action bar)
<style name="ActionBarStyle" parent="android:Widget.Holo.Light.ActionBar.Solid">
<item name="android:icon">@android:color/transparent</item>
</style>
and then add this to your Theme you have defined in AndroidManifest.xml (Standard is the AppBaseTheme in /res/values-v11/styles.xml - AppBaseTheme:
<item name="android:actionBarStyle">@style/ActionBarStyle</item>
Hope this helps!
This worked for me when I wanted to get the menu icon back from the back arrow
private void updateNavigationIcon() {
if (getSupportFragmentManager().getBackStackEntryCount() == 0
&& getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(false);
toggle.syncState();
}
}