Remove Android App Title Bar
Asked Answered
U

18

89

I understand that these properties in the manifest:

android:theme="@android:style/Theme.NoTitleBar"     
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

can remove the title bar. However, I constantly check the Graphical Layout when I am modifying my app. When I look at the Graphical Layout I still see the title bar. I want to remove the title bar in a way that I don't have to see it during the development of the game.

Underbelly answered 23/1, 2013 at 8:15 Comment(1)
try this in ur mainfest file: <application ....... android:theme="@android:style/Theme.NoTitleBar" >Proclaim
I
88
  1. In the Design Tab, click on the AppTheme Button

  2. Choose the option "AppCompat.Light.NoActionBar"

  3. Click OK.

Row of icons at the top of design view of a layout .xml in Android Studio, The dropdown box with the contrast icon will change the theme.

Introject answered 23/1, 2013 at 8:15 Comment(4)
Which version is "current" in your answer? Can't you just specify the name of the button instead of describing the position of it? In my "current" version I can't this mysterious button you are talking about...Desulphurize
really strange answer... just tell me the name of the button to look for. because things have changed, this answer is pretty useless nowDurra
FTR: this answer is over 4 years old and I do not do Android development with Eclipse anymore. If readers know where to find the name of the button (as it changes from version to version), then do not hesitate to edit it in.Introject
want hide only bottom navigation bar not the status bar. Is it possible to do?Deimos
F
115

Simple way is to put this in your onCreate():

// Java
getSupportActionBar().hide();
// Kotlin
supportActionBar?.hide()
Frederiksberg answered 29/5, 2017 at 11:52 Comment(2)
I tried all the other answers for this question, but this is the ONLY ANSWER that worked right away!!! Thanks.Medusa
Note that for ComponentActivity it is called just actionBarAcrimony
I
88
  1. In the Design Tab, click on the AppTheme Button

  2. Choose the option "AppCompat.Light.NoActionBar"

  3. Click OK.

Row of icons at the top of design view of a layout .xml in Android Studio, The dropdown box with the contrast icon will change the theme.

Introject answered 23/1, 2013 at 8:15 Comment(4)
Which version is "current" in your answer? Can't you just specify the name of the button instead of describing the position of it? In my "current" version I can't this mysterious button you are talking about...Desulphurize
really strange answer... just tell me the name of the button to look for. because things have changed, this answer is pretty useless nowDurra
FTR: this answer is over 4 years old and I do not do Android development with Eclipse anymore. If readers know where to find the name of the button (as it changes from version to version), then do not hesitate to edit it in.Introject
want hide only bottom navigation bar not the status bar. Is it possible to do?Deimos
C
28

for Title Bar

requestWindowFeature(Window.FEATURE_NO_TITLE);

for fullscreen

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);

Place this after

super.onCreate(savedInstanceState);

but before

setContentView(R.layout.xml);

This worked for me.try this

Closed answered 15/4, 2014 at 18:19 Comment(3)
Putting this after super.onCreate leads to this crash: requestFeature() must be called before adding contentAlibi
add that before setcontent(xml) after super.onCreate(savedInstanceState);Closed
Does this still work in Marshmallow? Doesn't seem to.Huckster
C
28

I was able to do this for Android 2.1 devices and above using an App Compatibility library theme applied to the app element in the manifest:

<application
    ...
    android:theme="@style/AppTheme" />

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar">
    ...
   <item name="windowNoTitle">true</item>
   <item name="android:windowNoTitle">true</item>
</style>

Note: You will need to include the com.android.support:appcompat-v7library in your build.gradle file

Champerty answered 3/7, 2015 at 12:44 Comment(1)
windowNoTitle is critical item to make it works in my case.Exuviate
P
17

There are two options I'd like to present:

  1. Change the visibility of the SupportActionBar in JAVA code
  2. Choose another Style in your project's style.xml

1: Add getSupportActionBar().hide(); to your onCreate method.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().hide();
    setContentView(R.layout.activity_main);
}

2: Another option is to change the style of your Application. Check out the styles.xml in "app->res->values" and change

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
Precontract answered 28/12, 2016 at 11:28 Comment(0)
S
10

Just use this

getSupportActionBar().hide();
Samoyed answered 15/11, 2017 at 18:39 Comment(0)
D
9

If you use AppCompat v7, v21

getSupportActionBar().setDisplayShowTitleEnabled(false);
Dracaena answered 14/11, 2015 at 17:14 Comment(0)
T
8

Use this to remove title from android app in your Androidmainfest.xml

android:theme="@android:style/Theme.NoTitleBar"

or you can use this in your activity

requestWindowFeature(Window.FEATURE_NO_TITLE); 
setContentView(R.layout.activity_main);
Tonsorial answered 10/3, 2014 at 12:23 Comment(1)
want hide only bottom navigation bar not the status bar. Is it possible to do?Deimos
C
7

If you have import android.support.v7.app.ActionBarActivity; and your class extends ActionBarActivity then use this in your OnCreate:

android.support.v7.app.ActionBar AB=getSupportActionBar();
AB.hide();
Cumulation answered 27/3, 2015 at 11:23 Comment(1)
Out of all the answers here, this is the only one that worked for me!Expeditionary
M
6

In the graphical editor, make sure you have chosen your theme at the top.

Mathian answered 23/1, 2013 at 8:19 Comment(0)
K
6

It's obvious, but the App Theme selection in design is just for display a draft during layout edition, is not related to real app looking in cell phone.

Just change the manifest file (AndroidManifest.xml) is not enough because the style need to be predefined is styles.xml. Also is useless change the layout files.

All proposed solution in Java or Kotlin has failed for me. Some of them crash the app. And if one never (like me) uses the title bar in app, the static solution is cleaner.

For me the only solution that works in 2019 (Android Studio 3.4.1) is:

in styles.xml (under app/res/values) add the lines:

   <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

After in AndroidManifest.xml (under app/manifests)

Replace

android:theme="@style/AppTheme">

by

android:theme="@style/AppTheme.NoActionBar">
Krakow answered 7/6, 2019 at 13:47 Comment(0)
E
5

Title bar in android is called Action bar. So if you want to remove it from any specific activity, go to AndroidManifest.xml and add the theme type. Such as android:theme="@style/Theme.AppCompat.Light.NoActionBar".

Example:

<activity
    android:name=".SplashActivity"
    android:noHistory="true"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>
Expect answered 2/9, 2020 at 20:23 Comment(0)
D
4

In your res/values/styles.xml of modern Android Studio projects (2019/2020) you should be able to change the default parent theme

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">

I went one step further and had it look like this

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowFullscreen">true</item>
</style>

This is based on the code generated from the Microsoft PWA builder https://www.pwabuilder.com/

Dorree answered 24/1, 2020 at 11:38 Comment(0)
L
2

in the graphical layout, you can choose the theme on the toolbar. (the one that looks like a star).

choose the NoTitleBar and have fun.

Laddy answered 23/1, 2013 at 8:20 Comment(0)
E
1

Use this Remove title and image from top.

Before:

setContentView(R.layout.actii);

Write this code:

requestWindowFeature(Window.FEATURE_NO_TITLE);
Erosion answered 5/8, 2014 at 5:40 Comment(0)
S
1

Just change the theme in the design view of your activity to NoActionBar like the one here

Soloman answered 2/7, 2016 at 10:56 Comment(0)
D
1

To open the Design window: res->layouts->activity_manifest.xml then click on the "Design" button, next to "Code" and "Split". On the TOP LEFT Corner.

enter image description here

Dockhand answered 19/3, 2021 at 23:8 Comment(1)
that will just hide it from the design view in android studio.Latta
B
0

Go to res/values/themes and change the third line to .NoActionBar like this in both.

<!-- Base application theme. -->
<style name="Theme.yourApp" parent="Theme.MaterialComponents.DayNight.NoActionBar">
Bettyannbettye answered 21/2, 2023 at 16:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.