Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Simple Android App Creating the Screen Layout Setting Padding

Patrick Hansen
Patrick Hansen
1,033 Points

I can't get rid of my action bar.

As the title states, i can't get rid of my actionbar, i checked the 2 other posts at no avail.

Manifest ´´´xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="neotic.funfacts">

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

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

</manifest> ´´´

styles ´´´xml <resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>

</resources> ´´´

layout ´´´xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#51b46d" android:padding="50dp" tools:context="neotic.funfacts.FunFactsActivity">

<TextView
    android:id="@+id/funFact"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Ants stretch when they wake up in the morning"
    android:textColor="@android:color/background_light"
    android:textSize="24sp"
    app:layout_constraintBottom_toTopOf="@+id/funFactButton"
    app:layout_constraintHorizontal_bias="1.0"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/didYouKnow"
    app:layout_constraintVertical_bias="0.527" />

<TextView
    android:id="@+id/didYouKnow"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Did you know?"
    android:textColor="@color/semiTransWhite"
    android:textSize="24sp"
    tools:layout_editor_absoluteX="7dp"
    tools:layout_editor_absoluteY="9dp" />

<Button
    android:id="@+id/funFactButton"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginBottom="16dp"
    android:background="@android:color/background_light"
    android:text="Show another fun fact!"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent" />

</android.support.constraint.ConstraintLayout> ´´´

java ´´´java package neotic.funfacts;

import android.support.v7.app.AppCompatActivity; import android.os.Bundle;

public class FunFactsActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fun_facts);
}

} ´´´