user3814312
user3814312

Reputation: 741

Android: How to get rid of the header bar in App?

For some reasons when I launch the app in the splash activity and in the row activity, see images, there is a header bar with the name of the app "Baby Read". I don't want the header there, how do I get rid of it? Splash Activity enter image description here

Row Activity [![enter image description here][2]][2]

This is the splash layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/babyreadappsplash"
    >

</LinearLayout>

And this is the row layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

    <ImageView
        android:id="@+id/icon"
        android:layout_width="90px"
        android:layout_height="90px"
        android:layout_marginLeft="10px"
        android:layout_marginRight="10px"
        android:layout_marginBottom="10px"
        android:layout_marginTop="10px"
        android:src="@drawable/ic_launcher" >
    </ImageView>

    <TextView
        android:id="@+id/label"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@+id/label"

        >
    </TextView>

This is res/values/styles after adding the code suggested [![enter image description here][3]][3]

And this is the manifest after adding the code suggested enter image description here

Upvotes: 0

Views: 182

Answers (3)

Marco Pierucci
Marco Pierucci

Reputation: 1215

No need to create anew theme (At least for this purpose)

  • Modify you app theme (Picture one)change parent="android:Theme.Holo.Light.DarkActionBar" for parent="android:Theme.Holo.NoActionBar"
  • On you manifest, in the application section (picture 2)add

        android:theme="@style/AppTheme"
    

If by any change you are supporting APIs below 13 you can add

<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>

to your app theme rather than changing the parent.

As a side note I would advise moving from Holo themes to Appcompat or even Material, but that´s out of the scope of this question

Upvotes: 0

Jimale Abdi
Jimale Abdi

Reputation: 2844

Create a style for your splash Activity like this

<style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>

    </style>

after that set this style for your splash Activity in Manifest

<activity
            android:name="activity name"
            android:theme="@style/AppTheme.NoActionBar"
             />

Update make your style like this

<style name="splashStyle" parent="Theme.AppCompat.Light.NoActionBar">
    //add other attributes
    </style>

if not work for you change the parent of your AppTheme to Theme.AppCompat.Light.ActionBar

Upvotes: 3

Krystian G
Krystian G

Reputation: 2941

You can use this in onCreate:

  getSupportActionBar().hide(); 

Upvotes: 0

Related Questions