How to remove the title when starting the application for Android?

I am already removing the header in the 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 the application starts.

launching the app

And I can use

 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 

or place

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

to the manifest file because I use actionBar. If I do this, the application will crash.

So my question is, is there a way to remove the title when the application starts, because I'm going to post a splash screen here. Thanks.

-----------

PLEASE NOTICE:

Thanks for your answers, but I clearly said that I already used actionBar.setDisplayShowTitleEnabled(false); to hide the activity title bar. (as shown in the first shot) , but the title bar is still displayed on the launch screen (as shown in the second figure.)

and

 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 

and

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

will trigger the crashes. This happens after I used the action bar.

+6
source share
12 answers

I had the same problem.

Personally, I solved this by replacing my Activity inheritance from ActionBarActivity for activity.

Hope this helps someone ...

+6
source

Do this in the onCreate () method.

// Delete the title bar

 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 

// Delete the notification bar

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

this refers to Activity.

============

EDIT:

if you use ActionBarSherLock

 final ActionBar bar = getSupportActionBar(); bar.setDisplayShowTitleEnabled(false); 
0
source

This may be a failure because you are using this.requestWindowFeature(Window.FEATURE_NO_TITLE); after setContentView() ;

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

0
source

Maybe I repeat the same thing that everyone says, but I just need to confirm it. In the manifest file, add a theme, as shown below, which I added as a sample or any other way.

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

Just delete all the other code related to just hide the title bar, and just add this to the manifest file, which it works for me. I hope this works for you too.

0
source

Nick Butcher and Katherine Kuan have written a nice post on Google Plus about a smoother application launch:

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 to achieve this is to use a separate launch activity using a theme without an action bar.

0
source

Set splashscreen as the main action and set the theme

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

Create and intend to transfer your screensaver to your main activity.

0
source

Use this:

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

or

  ActionBar bar = getActionBar(); bar.setDisplayShowHomeEnabled(false); bar.setDisplayShowTitleEnabled(false); 
0
source

in res / values ​​/styles.xml

to find...

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

for replacement.

 <!-- 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 ...

0
source

Put below three lines in onCreate Method before setContentview in your activity who want to display fullscreen

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

0
source

Hopes below the 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); 
0
source

You can simply add a full-screen theme to this activity in the manifest file:

 android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" 
-1
source

In your AndroidManifest.xml in the application tag, set your theme in full screen mode, as shown below.

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

Source: https://habr.com/ru/post/950148/


All Articles