android hide toolbar in specific fragment

前端 未结 9 1263
既然无缘
既然无缘 2021-01-31 08:20

I have a problem that I don\'t know how to solve. How do you hide a toolbar in a specific fragment, I have already been searching around on the internet and what I found was com

9条回答
  •  再見小時候
    2021-01-31 08:45

    Put this code in fragment in which you want to hide toolbar...

    Add this( ((AppCompatActivity)getActivity()).getSupportActionBar().hide();) in onCreateView or in onResume.

    and do this in onDestroy()

    @Override
    public void onDestroy() {
    super.onDestroy();
    ((AppCompatActivity)getActivity()).getSupportActionBar().show();}
    

提交回复
热议问题