In the activities where you want to have no action bar use a theme derived from Theme.AppCompat.NoActionBar
or Theme.AppCompat.Light.NoActionBar
. This activity will never be able to show the action bar unless you supply your own via setSupportActionBar(Toolbar)
.
In the activities where you want to have the action bar use a theme derived from Theme.AppCompat
, Theme.AppCompat.Light
or Theme.AppCompat.Light.DarkActionBar
. This will allow you to dynamically hide or show the action bar in such activity. You will not be able to supply your own action bar using these themes.
When working with appcompat-v7 action bar you need to obtain it by calling getSupportActionBar()
instead of getActionBar()
.