How to hide action bar for fragment?

前端 未结 9 1262
挽巷
挽巷 2021-01-31 08:17

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

9条回答
  •  感情败类
    2021-01-31 09:01

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

     @Override
    public void onResume() {
        super.onResume();
        ((AppCompatActivity)getActivity()).getSupportActionBar().hide();
    }
    @Override
    public void onStop() {
        super.onStop();
        ((AppCompatActivity)getActivity()).getSupportActionBar().show();
    }
    

提交回复
热议问题