0

I've followed the plethora of helpful and thorough instructions around SO and the internet in general regarding removing ActionBars in an Activity. I've tried to do so via the onCreate() method and XML but my ActionBar has irritatingly remarkable resilience.

I tried this code in my onCreate() method and the notification bar disappeared, but the ActionBar did not.

I have, of course, tried appending android:theme="@android:style/Theme.NoTitleBar" and quite a few other .NoActionBar and .NoTitleBar themes in the XML to the first RelativeLayout (is this the right place to put it? It's the highest level automatically present), to no effect.

Any ideas as to why these methods have failed?

Community
  • 1
  • 1
userManyNumbers
  • 867
  • 2
  • 10
  • 24

2 Answers2

2

Here is the nuclear option. Extend your Activity as

public class MainActivity extends Activity{

    ...

}

instead of

public class MainActivity extends ActionBarActivity{

    ...

}
Y.S
  • 29,283
  • 12
  • 91
  • 116
1

In your onCreate method, execute this code:

getActionBar().hide();
Marcus
  • 6,599
  • 11
  • 44
  • 85
  • I thought he said he already tried everything ... he *must* have tried this, right ? – Y.S Feb 21 '15 at 10:57
  • 1
    If he would have tried _everything_, this question would not be asked :-) @ZygoteInit – Marcus Feb 21 '15 at 10:59
  • 1
    Well, what I mean is that `getActionBar().hide()` is the first and most trivial thing anybody would do :) – Y.S Feb 21 '15 at 11:03
  • You'd be surprised... :-) @Zygotelnit. Anyway, upvoted your answer. – Marcus Feb 21 '15 at 11:14