Can be done with a nice one liner
getActionBar().setDisplayShowTitleEnabled(false)
this will hide just the title. If you also want to hide the home logo
getActionBar().setDisplayShowHomeEnabled(false);
When using the AppCompat Support library, you should replace getActionBar()
with getSupportActionBar()
. It is also suggested that you check if the ActionBar is null before changing values on it.
ActionBar actionBar = getSupportActionBar()
if (actionBar != null) {
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…