How Can we hide title bar while using action bar?

前端 未结 10 1989
闹比i
闹比i 2021-02-12 14:43

I\'m using ActionBarSherlock and I\'m trying to hide the title bar of my application but whenever I do that, I get a NullPointerException when accessing the A

10条回答
  •  梦如初夏
    2021-02-12 15:07

    I had the same problem. None of these answers worked for me, I still had a glimpse of the Title Bar showing right before Actionbar loaded.

    I had to set the Activity theme to NoActionBar in the Manifest:

    android:theme="@style/Theme.Sherlock.NoActionBar"
    

    And then set the theme back inside my Activity right before setContentView():

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    
        setTheme(R.style.Theme_Custom);
        setContentView(R.layout.activity_home);
    }
    

    This still loaded my custom theme and I no longer see a glimpse of the Title bar when activity loads

提交回复
热议问题