Ankit Srivastava
Ankit Srivastava

Reputation: 135

How to remove Titlebar?

I am trying to remove title bar from my activity but it is not getting removed.

Here is my code

public class SplashScreen extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.activity_splash_screen);


    }
}

With or without the requestWindow line the output is the same then what is the use of that line?

Upvotes: 0

Views: 3791

Answers (4)

Ashray P. Shetty
Ashray P. Shetty

Reputation: 700

Can you try adding this to your manifest inside activity tag :

<activity
        android:name="your_app_packagename.activity_name"
        android:theme="@android:style/Theme.NoTitleBar" >

also try this in your activity :

ActionBar actionBar = getActionBar();
actionBar.setDisplayShowTitleEnabled(false);

Upvotes: 1

Rishabh Sharma
Rishabh Sharma

Reputation: 268

Apply this theme in your activity declared in the Manifest File.

<activity
    android:name=".SplashScreenActivity"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">
</activity>

Upvotes: 1

John Joe
John Joe

Reputation: 12803

Add this in onCreate

   getSupportActionBar().setDisplayShowTitleEnabled(false);
   getSupportActionBar().setDisplayShowHomeEnabled(false);

Upvotes: 0

Jared
Jared

Reputation: 2217

I would reccomend editing your theme with no title bar. For example use of of these...

<style name="Theme.NoTitle" parent="@android:style/Theme.NoTitleBar"></style>
<style name="Theme.FullScreen" 
parent="@android:style/Theme.NoTitleBar.Fullscreen"></style>

Upvotes: 1

Related Questions