Navigation Drawer Icon Not Showing (sherlock Actionbar)
Solution 1:
Have you tried implementing the method:
mDrawerToggle.syncState();
This has worked for me in the past.
Solution 2:
This solution worked for me, and showed default navigation drawer icon in all version.
Add SherlockNavigationDrawer
library from here https://github.com/nicolasjafelle/SherlockNavigationDrawer to your project.
And change your code as below :
SherlockActionBarDrawerToggle mDrawerToggle = newSherlockActionBarDrawerToggle(this,mDrawerLayout,
R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close) {
publicvoidonDrawerClosed(View view) {
super.onDrawerClosed(view);
}
publicvoidonDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
getSupportActionBar().setIcon(R.drawable.ic_launcher);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
Solution 3:
Though I'm guessing by now you must have worked it out, just wanted to submit an answer:
Change your code to the following:
mDrawerToggle = newActionBarDrawerToggle(this, mDrawer,
R.drawable.ic_drawer, R.string.menu_open, R.string.menu_close) {
publicvoidonDrawerClosed(View view) {
super.onDrawerClosed(view);
}
publicvoidonDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);
getSupportActionBar().setIcon(R.drawable.myIcon);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
Essentially, the ActionBar options that you are setting in code need to be set after the DrawerToggle has been completed, not before.
Solution 4:
You can look at this post first. There is one answer: "You can change back icon in Theme
<item name="android:homeAsUpIndicator">@drawable/action_arrow</item>
But I think you want implement Navigation Drawer, so read about it.
Solution 5:
What you can do is create a style like below:
<stylename="AppTheme"parent="Your Theme name"><itemname="homeAsUpIndicator">@drawable/ic_drawer</item></style>
And in Android manifest apply this theme like:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
</application>
This will solve the issue getting the 3 line icon for sure.
Post a Comment for "Navigation Drawer Icon Not Showing (sherlock Actionbar)"