Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio: Remove default header

I am just beginning to learn Android Studio (version 2.0, running on Windows 7). When I create a new project (Empty Activity template) Android Studio places a header at the top of the project. How can I remove the header?

Here's a picture of the problem. I want to get rid of the 'My Greeting Card' header.

enter image description here

like image 212
Argent Avatar asked Apr 10 '16 06:04

Argent


People also ask

How to get rid of the header in Android studio?

There are lots of Themes available. Just remove DarkActionBar it and press Cntrl+Space to explore another themes. In your case, you do not want Header which is called ActionBar in Android Terminology. So, Just change theme to Theme.


2 Answers

You have to simply navigate like below....

app -> res -> values -> styles.xml

Find <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> line.

Theme.AppCompat.Light.DarkActionBar line shows, how your activity will look like.

There are lots of Themes available. Just remove DarkActionBar it and press Cntrl+Space to explore another themes. In your case, you do not want Header which is called ActionBar in Android Terminology.

So, Just change theme to Theme.AppCompat.Light.NoActionBar and you are done.

To get more deeply about how the theming work and other courses of Android, Just try Pluralsight. Go to below link and get 6 months free subscription. It is very good website to learn any technology.

Pluralsight 6 Months Subscription

like image 150
Maulik Dodia Avatar answered Oct 09 '22 06:10

Maulik Dodia


Well the answer is already given, but still i would like to add if you don't want any kind of actionbar on top of the activity simply do this. go to your res->values->styles.xml and add these xml code

<resources>
    <!-- Base application theme. -->
    <style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">#3F51B5</item>
        <!-- Light Indigo -->
        <item name="colorPrimaryDark">#3949AB</item>
        <!-- Dark Indigo -->
        <item name="colorAccent">#00B0FF</item>
        <!-- Blue -->
    </style>
    <style name="AppTheme" parent="AppTheme.Base"></style>
</resources>

and reference the theme in the style on any activity you want, like below in the manifest using android:theme=@style/AppTheme.

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".DetailActivity"
            android:parentActivityName=".MainActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity" />
        </activity>
    </application>
like image 32
vikas kumar Avatar answered Oct 09 '22 04:10

vikas kumar