Nikhil
Nikhil

Reputation: 1151

Android: Remove title from activity

I've added this code to onCreate in each of my activites.

requestWindowFeature(Window.FEATURE_NO_TITLE);

However, when running on my phone, there's a brief moment on loading the app where it can be seen. Is there a way to remove it altogether? I don't want the title bar on any of my activites.

Upvotes: 0

Views: 5454

Answers (8)

K.A. Siddiqui
K.A. Siddiqui

Reputation: 49

In your Manifest file just paste this inside the activity tags

<android.support.v7.widget.Toolbar
            android:layout_width="0dp"
            android:layout_height="0dp"
            />

Upvotes: 0

Beginner
Beginner

Reputation: 1424

requestWindowFeature(Window.FEATURE_NO_TITLE); 

should be used before setContentView();

EDIT

public void onCreate(Bundle savedInstanceState) {  
        super.onCreate(savedInstanceState);  

        //set up notitle 
        requestWindowFeature(Window.FEATURE_NO_TITLE);  
        //set up full screen
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,   
                WindowManager.LayoutParams.FLAG_FULLSCREEN);  

        setContentView(R.layout.main);  
} 

Upvotes: 2

Deepak
Deepak

Reputation: 2009

If you don't want to show Title bar in your whole application then you can change your base theme of your application in style.xml from project res and inside values directory.

For me it default comes like

<style name="AppBaseTheme" parent="android:Theme.Light">

and I change it to

<style name="AppBaseTheme" parent="android:Theme.Light.NoTitleBar">

and it works for me. Hope this helps you.

Upvotes: 0

user2552212
user2552212

Reputation: 13

In order to drop the title bar for all your activities you can change the android:theme attribute in the application tag of your manifest file as in:

<application
   android:icon="@drawable/icon"
   android:label="@string/app_name"
   android:theme="@android:style/Theme.NoTitleBar.Fullscreen"

Hope this helps

Upvotes: 0

Rajesh
Rajesh

Reputation: 2618

in your AndroidManifest.xml modify your activity like this.

<activity
        android:name="com.example.test.Second"
        android:label="@string/title_activity_second"
        android:theme="@android:style/Theme.Light.NoTitleBar" >
    </activity>

Upvotes: 0

Sunil Kumar
Sunil Kumar

Reputation: 7082

put this line in style.xml file

<style name="AppTheme" parent="AppBaseTheme">
     <item name="android:windowNoTitle">true</item>
 </style>

It will gives the new api features looks and feel and if you change the style like

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

then it gives the lower version api look and feel

Upvotes: 2

nedaRM
nedaRM

Reputation: 1827

You can modify your AndroidManifest.xml:

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

Upvotes: 0

Pankaj Kumar
Pankaj Kumar

Reputation: 83048

You can define theme attribute into application tag in manifest

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

or can use style as

<style name="generalnotitle" parent="general">
    <item name="android:windowNoTitle">true</item>
</style>

Read more at : -

How to hide the title bar for an Activity in XML with existing custom theme

How disable / remove android activity label and label bar?

Upvotes: 1

Related Questions