I have some troubles trying to remove a toolbar in a specific fragment, i have this code in onCreateView fragment method:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_login,container,false);
mValidator = new Validator(this);
mValidator.setValidationListener(this);
mFbHelper = new
mGHelper = new GoogleHelper(this, null, this);
((DrawerUtil) getActivity()).setDrawerLocked(true);
((AppCompatActivity) getActivity()).getSupportActionBar().hide();
initViews(view);
return view;
}
I can hide the ActionBar, but the idea is to remove the ActionBar to use properly a logo, im using this code: ((AppCompatActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(state);
but it doesnt work.
Any ideas?
For a specific fragment you can use :
override fun onStart() {
super.onStart()
(activity as AppCompatActivity).supportActionBar!!.hide()
}
override fun onStop() {
super.onStop()
(activity as AppCompatActivity).supportActionBar!!.show()
}
override fun onResume() {
super.onResume()
(activity as AppCompatActivity).supportActionBar!!.hide()
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With