Search code examples
javaandroidandroid-actionbarhide

How to hide a actionbar for a moment on a layout which is not an activity


I want to hide the action bar on my charging screen but it's not an activity, it's just a layout over an activity.


Solution

  • Try to call getSupportActionBar().show(); or getSupportActionBar().hide(); in your activity every time you want to show or hide your layout

    ActionBar actionBar = getSupportActionBar();
        if (actionBar != null){
            actionBar.show();
            //actionBar.hide();
        }
    

    You can find more info about how to hide Android ActionBar here