-6

Okay, so I've been trying to remove the title bar of my application:

enter image description here

Now, I've done my research and all. I've seen this, where the advice says to add this in manifest:

enter image description here

I have done this, and, in design view of the xml, the title is still there! Also, I get an exception when running saying that I cannot change the layout on setContentView.

enter image description here

The title is still there. How do I get rid of that properly? I also tried the method where you put <item name="windowActionBar">false</item> in the Styles.xml, but still no luck...I know about the many solutions of how to do this in Java, but I don't want to do it in Java.

Community
  • 1
  • 1
Ruchir Baronia
  • 7,406
  • 5
  • 48
  • 83
  • for now question is off-topic: *Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself.* ... the answer depends on which Activity class you are using (the compat or default) and the minimal api which you are targeting – Selvin Dec 14 '15 at 13:24
  • @Selvin Um. How is that off topic though? I'm sure users in the future will also have this question. There are also 6 answers that, so far, don't work, meaning that this may be an unanswered question. If you are planing on closing this question, please dont, as people like me, who are having this problem, won't know what to do. :) – Ruchir Baronia Dec 14 '15 at 13:27
  • the anser is already [here](http://stackoverflow.com/questions/2591036/how-to-hide-the-title-bar-for-an-activity-in-xml-with-existing-custom-theme) ... *please dont, as people like me, who are having this problem* ... then fix the question ... as I wrote *a specific problem or error and the shortest code necessary to reproduce it* ... there is no specific problem in your question and i did provide even information what you forgot to mention about – Selvin Dec 14 '15 at 13:28
  • @Selvin ...I am the one that linked that question in **my** question...Don't you think that I would have read the question that **I linked** before posting one that is similar? _then fix the question_ I don't see anything wrong with it. If you are trying to be some sort of SO moderator, why don't you suggest an edit to me, or kindly give me some feedback stating what is wrong with it? The statement _fix the question_ won't do any good. – Ruchir Baronia Dec 14 '15 at 13:33
  • Please read with understaning : from my first comment **the answer depends on which Activity class you are using (the compat or default) and the minimal api which you are targeting** ... so obviously by *fix the question* i meant **provide this information in the question itself** .... also if you are writing *I also tried the method where you put false in the Styles.xml, but still no luck* you should provide what have you tried ... as fx for me putting `false` is working! (min api 13 without support library) – Selvin Dec 14 '15 at 13:34
  • @Selvin Actually, you are wrong. Although there may be certain styles that are unusable depending on your criterion, it is possible to do what I am saying on all api's. Also, the Activity class doesn't matter here, as in my question (if you had carefully read) states _I don't want to do it in Java._. So this is **all** about android resource files. Thanks for the downvote and the closevote. – Ruchir Baronia Dec 14 '15 at 13:38
  • *it is possible to do what I am saying on all api's* ... bingo!, you are wrong and this paragraph is a proof that question is off topic ... as is opposite to `must include the desired behavior` – Selvin Dec 14 '15 at 13:40
  • @Selvin I think you forgot to attach the paragraph link...also, I got an answer that works... **everywhere**. – Ruchir Baronia Dec 14 '15 at 13:42
  • *everywhere* ... you are wrong again ... it will not work without `appcompat-v7` library – Selvin Dec 14 '15 at 13:54
  • 1
    **Please stop relying so heavily on images in your posts**. Many of the contribution you make to this site involve images, often needlessly. Please stop posting images of code, and instead take the time to **write the code in the question**. Images of code do not count *as code*, and your questions seeking debugging help must contain the code you're asking about. – user229044 Dec 14 '15 at 13:54
  • @meagar Okay, I'll use less images. But, I don't have any questions seeking debugging...Thanks for the advice...and I noticed you made 22+ edits in the last 10 minutes of my questions/answers, thanks for improving them. If you have more feedback about the way I use Stack Overflow, please let me know through comments and chat, rather than downvotes. I want to improve my questions and answers. Thanks meagar! :-) – Ruchir Baronia Dec 14 '15 at 14:03

5 Answers5

1

you can simply use one of the NoActionBar themes available. Since you are setting it on your <application tag, it will affect all the Activitis of your App. Keep in mind that you can always override is behaviour per <activity tag

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
1

try this:

android:theme="@style/Theme.AppCompat.Light.NoActionBar"

in your activity tag in manifest.

riaz hasan
  • 1,155
  • 2
  • 8
  • 20
0

Make sure in your xml there is a Toolbar component, if so try to remove it.

Marcus Martins
  • 424
  • 6
  • 19
0

try this following code....

android:theme="@android:style/Theme.NoTitleBar"
Subhash Khimani
  • 427
  • 7
  • 22
0

I think you can try this,

<activity android:name=".MainActivity"
          android:label="@string/app_name"
          android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen">

Or inside OnCreate() of MainActivity do this,

//Remove title bar
this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

//set content view AFTER ABOVE sequence (to avoid crash)
this.setContentView(R.layout.your_layout_name_here); 
Amit
  • 13,134
  • 17
  • 77
  • 148
  • i did that, but I got `Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.` – Ruchir Baronia Dec 14 '15 at 13:24
  • then read the link that you provide again ... there is a solution for appcompat too! – Selvin Dec 14 '15 at 13:25