Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't supportRequestWindowFeature() work?

I have a problem and I've been trying to find the mistake for a couple hours but I just can't find it?

My situation: I don't want that my titlebar appears. My device is a HTC and runs android 2.3.3. I tried it with supportRequestWindowFeature() but somehow it doesn't work.

My code is here:

  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_main);
  }     

Also my MainActivity extends ActionBarActivity.

like image 451
adiii4 Avatar asked Aug 09 '26 05:08

adiii4


1 Answers

Place supportRequestWindowFeature above super.oncreate:

@Override
protected void onCreate(Bundle savedInstanceState) {
  supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
} 
like image 51
Rahul Khatri Avatar answered Aug 12 '26 15:08

Rahul Khatri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!