How can I hide action bar for certain fragment? I have searched for the answer at stackoverflow, but I have only found a solution, which involves disabling action bar for main a
Have you tried getActivity().getSupportActionBar().hide()
in the onCreate()
of the fragment you wish the ActionBar to be hidden in?
I am assuming you are not using ActionBarSherlock
.
You can simply put this into your Fragment Class createView method:-
View layout = inflater.inflate(R.layout.player_fragment, container, false);
((AppCompatActivity) getActivity()).getSupportActionBar().hide();
Hide actionBar using this in the required fragment.
getActivity().getSupportActionBar().hide();
And Show actionBar with this in your next fragment.
getActivity().getActionBar().show();