Reputation: 3403
I have hidden the navigation drawer hamburger icon using the following code in onCreate.
final android.support.v7.app.ActionBar actionBar = ((AppCompatActivity) getActivity()).getSupportActionBar();
if(actionBar!=null) {
actionBar.setHomeAsUpIndicator(null);
}
When I move to other fragments also this is hidden, how can I bring the icon back once I move away from this fragment?
Upvotes: 0
Views: 734
Reputation: 1151
You can set the icon using drawable
actionBar.setHomeAsUpIndicator(R.drawable.hamburger_icon);
Upvotes: 1
Reputation: 69699
try this to get deafult hamburger_icon drawable
actionBar.setHomeAsUpIndicator(R.drawable.ic_drawer);
actionBar.setDisplayHomeAsUpEnabled(true);
crate this ic_drawer.xml in drawable folder
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/>
</vector>
Upvotes: 0