sparrkli
sparrkli

Reputation: 671

Remove app title bar android

I know this question has been asked million times but whichever method I use is not good for me.

If I use

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

in the manifest file, the whole theme of the app changes. If I put

requestWindowFeature(Window.FEATURE_NO_TITLE);

in the onCreate activities, it shows up shortly when starting an app.

Btw I don't have any theme selected, just using standard android.

Upvotes: 22

Views: 93829

Answers (9)

Aaron Thompson
Aaron Thompson

Reputation: 1889

If you have made a custom theme in styles.xml you can do this:

<style name="AppTheme" parent="android:Theme.Material.Light">
    <!-- Override the android colour scheme etc. -->
    <item name="android:colorPrimary">@color/color_primary</item>
</style>

To remove the Action bar and title add to styles.xml:

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

Then in your AndroidManifest.xml you can use your custom theme with or without the action bar

<application
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme"> <---- With action bar
    <activity
        android:theme="@style/AppTheme.NoActionBar"> <---- No action bar
        <intent-filter>
etc...

Upvotes: 0

Samir
Samir

Reputation: 6605

Inside AndroidManifest

 <activity
            android:name=".activity.HomeMenu"
            android:screenOrientation="nosensor"
            android:theme="@android:style/Theme.Light.NoTitleBar">
            <intent-filter>

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

and make sure your Class extends to Activity

Upvotes: 0

Bhanz
Bhanz

Reputation: 484

This is what worked for me

 android:theme="@style/Theme.AppCompat.NoActionBar">

Upvotes: 4

Fawaz
Fawaz

Reputation: 3560

For android 8 and above support. Use this in your app theme file. I've modified my default in res/styles.xml :

<style name="AppTheme" parent="Theme.AppCompat.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:windowNoTitle">true</item>
    <item name="android:background">@color/white</item>
</style>

Upvotes: 1

user3541496
user3541496

Reputation: 131

To remove the title bar from your app in android studio

  1. Open res > values > styles.xml file
  2. Replace your code with:

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

Upvotes: 13

user3821354
user3821354

Reputation: 111

Open your style.xml file, create a new style just like below. You choose your own name and set the parent as below

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

In your AndroidManifest.xml file, set the theme name for the specific activity you dont want the bar to show and you are done

<activity  android:theme ="@style/your_own_name" >
</activity>

Upvotes: 10

MohdTausif
MohdTausif

Reputation: 508

when you create a new project in android then you will get default theme applied on your project, that has title bar. but if you want to remove or apply some other theme for your whole App then you can define like below at application level:

<application
        android:name="com.mycomp.myproj.MainApplication"
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Sherlock" >

but if you want to apply some theme only at some specific screens then you can define like below at activity level:

<activity
            android:name="com.mycomp.myproj.MainActivity"
            android:label="@string/app_name" 
            android:theme="@style/AppTheme">

Upvotes: 1

Aswin Rajendiran
Aswin Rajendiran

Reputation: 3409

If you add the theme to the application, it applies to the whole app.

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

You have to add it to the activity declaration.

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

Upvotes: 17

CommonsWare
CommonsWare

Reputation: 1006604

It is unclear what you mean by "whole theme of app changes". For API Level 11+ devices, you probably should be using @android:style/Theme.Holo.NoActionBar.

Upvotes: 27

Related Questions