How to remove the title when launching android app?
Asked Answered
M

12

6

I already remove the title in onCreate() method.

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final ActionBar actionBar = getActionBar();
    actionBar.setHomeButtonEnabled(false);
    actionBar.setDisplayShowHomeEnabled(false);
    actionBar.setDisplayUseLogoEnabled(false);
    actionBar.setDisplayShowTitleEnabled(false);
}

after launched

The title is not displayed. But still appears when launching the app.

launching the app

And I can use

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

or put

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

into manifest file because I'm using actionBar. If I did that, the app crashes.

So, my question is, is there any way to remove the title when the app is launching because I am gonna put a splashscreen here. Thanks.

-----------

PLEASE NOTICE:

Thanks for your answers, but I clearly said that I already used actionBar.setDisplayShowTitleEnabled(false); to hide the title bar of the activity. (as shown in the first picture) BUT the title bar still appears in the launching screen (as shown in the second picture.)

and

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

and

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

would lead to crash launch. This happens after I used actionbar.

Moo answered 24/7, 2013 at 4:58 Comment(2)
Was this ever solved?Apiarist
No, I still have to keep that title bar.Moo
B
6

I had the same problem.

Personally, I solved it by replacing my Activity inheritance from ActionBarActivity to Activity.

Hope this will help someone...

Baird answered 25/2, 2015 at 13:53 Comment(2)
After 3 hours of searching, this is the best answer, Thanks in advance!Excoriate
I agree with Amr SubZeroSon
M
0

Do this in your onCreate() method.

//Remove title bar

this.requestWindowFeature(Window.FEATURE_NO_TITLE);

//Remove notification bar

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

this refers to the Activity.

===========

EDIT:

if you are using ActionBarSherLock

final ActionBar bar = getSupportActionBar();
bar.setDisplayShowTitleEnabled(false);
Misbecome answered 24/7, 2013 at 5:10 Comment(1)
the Window.FEATURE_BO_TILTE would lead to crash when launching the app. And I did setDisplayShowTitleEnabled(false) which hides the title bar of the activity but still does not hide it when launching it.Moo
N
0

It might be crashing because you are using this.requestWindowFeature(Window.FEATURE_NO_TITLE); after setContentView();

Use this.requestWindowFeature(Window.FEATURE_NO_TITLE); in onCreate() of your Activity , before setContentView(); statement.

Nostology answered 24/7, 2013 at 5:17 Comment(1)
I know it should be put after setContentView(), and it lead to crash launching the app.Moo
I
0

May be i am repeating the same which all are saying but i just need to confirm it.In manifest file have add the theme like the below which i added as sample or anyother way.

<application .... android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:largeHeap="true"> .. </application>

Just remove all other code related to hide title bar only andonly add this one in the manifest file it works for me.I hope it will work to you too.

Illegality answered 24/7, 2013 at 6:20 Comment(2)
If you use the Tab Fragment example provided by developer.android.com, you will found you can't add this in the manifest file as it will crash... Don't know whyMoo
you just try this link dude.#14403988Illegality
P
0

Nick Butcher and Katherine Kuan wrote a nice Google Plus post about a smoother app launch experience:

https://plus.google.com/+AndroidDevelopers/posts/VVpjo7KDx4H

However, if you want to be compatible with Android versions below API 14 (for example using AppCompat), the only way I could achieve this is by using a separate launch activity using a theme with no actionbar.

Paratuberculosis answered 9/4, 2014 at 8:37 Comment(0)
P
0

Set your splashscreen as your main activity and set the theme to

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

create and intent to move your splash screen to your actual main activity

Phyllys answered 19/4, 2014 at 10:28 Comment(0)
R
0

Use this:

 ActionBar bar = getActionBar();    
 bar.hide();

or

    ActionBar bar = getActionBar();
    bar.setDisplayShowHomeEnabled(false);
    bar.setDisplayShowTitleEnabled(false);
Ruphina answered 22/8, 2014 at 2:30 Comment(0)
C
0

in res/values/styles.xml

find ...

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
   <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

replacing for.

<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
    <item name="windowActionBar">false</item>
    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

Save and compile...

Complicate answered 31/1, 2017 at 3:54 Comment(0)
A
0

Put below three line in onCreate Method before setContentview in your activity which want to display full screen

requestWindowFeature(Window.FEATURE_NO_TITLE); super.onCreate(savedInstanceState); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

Aves answered 31/1, 2017 at 4:9 Comment(0)
D
0

Hope below lines will help you

    getWindow().clearFlags(
            WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); 
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
Delinquency answered 9/3, 2017 at 11:22 Comment(0)
A
-1

You can simply add full screen theme to that activity in your manifest file:

android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
Airtoair answered 24/7, 2013 at 5:40 Comment(1)
Anything else instead of this?Genevivegenevra
H
-1

In your AndroidManifest.xml in application tag set your theme to full screen like in below code.

android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Hostetter answered 24/7, 2013 at 5:42 Comment(1)
sorry, as I mentioned, this would lead to crash in the app since I use actionbar.Moo

© 2022 - 2024 — McMap. All rights reserved.