Since it is expected that we will continue to encounter implementations that do not display the toolbar only for specific fragments in Android development, we will summarize it below including a memorandum.
kotlin
//I want to hide
(activity as AppCompatActivity?)!!.getSupportActionBar()!!.hide()
//I want to display
(activity as AppCompatActivity?)!!.getSupportActionBar()!!.show()
Java
//I want to hide
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
//I want to display
((AppCompatActivity)getActivity()).getSupportActionBar().show();
That is all.
This is the article I referred to this time. Please refer to it for more details. (Java.) https://stackoverflow.com/questions/29128162/android-hide-toolbar-in-specific-fragment
We hope for your reference.
Recommended Posts