Android Build a Simple Android App Creating the Screen Layout Setting a Fullscreen Theme

Aaron Coursolle
Aaron Coursolle
18,013 Points

I never had an action bar to begin with?

Why isn't my action bar showing up at all? Everything else appears the same as the video [AndroidManifest.xml]

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        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>

[activity_fun_facts.xml]

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="teamtreehouse.com.funfacts.FunFactsActivity"
    android:background="#51b46d">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Did You Know?"
        android:textSize="24sp"
        android:textColor="#80ffffff" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Ants stretch when they wake up in the morning"
        android:id="@+id/factTextView"
        android:layout_centerVertical="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:textSize="24sp"
        android:textColor="@android:color/white" />

    <Button
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Show Another Fun Fact"
        android:id="@+id/showFactButton"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@android:color/white" />
</RelativeLayout>

[styles.xml]

<resources>

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

</resources>

In the last xml file, the reason why <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> was changed to <style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar"> is because of an earlier bug would have prevented the preview from properly rendering.

I also changed com.android.support:appcompat-v7:23.4.0

to

com.android.support:appcompat-v7:23.1.0

in the gradle scripts > build.gradle file for the same reason.

Viktor Khon
Viktor Khon
2,798 Points

I have the same problem. I don't have it when I work in Android Studio, but when I run it, it still there and I do not have NoActionBar option. Wish someone could answer this...