Search code examples
javaandroidandroid-actionbar

How to hide (or remove) Action Bar at run time in android application


I have created an application. There is a login activity so I just want to remove the action bar at runtime. What should I do ???

See Screenshot

You can see in the image blue action bar. I just want to remove this only.

Thanks


Solution

  • If you are using the AppCompatActivity, then you can perform action:

    // to hide the action bar
    getSupportActionBar().hide();
    // to show the action bar
    getSupportActionBar().show();
    

    If you are using the Activity, then you can perform action:

    // to hide the action bar
    getActionBar().hide();
    // to show the action bar
    getActionBar().show();
    

    Note: This work only of You are using the Theme with Action Bar.