Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build an Interactive Story App (Retired) User Input Hiding the ActionBar with an App Theme

Adin Lopez
Adin Lopez
2,272 Points

i can't eliminate the top bar! any help?

i try to edit the AndroidManifest.xml and my app crashes when i do that

this is the top bar i want to eliminate

3 Answers

Adin Lopez
Adin Lopez
2,272 Points

i found another question with the answer needed

just delete

<android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay"/>

located here

res/ layout/ activity_main.xml

problem solved!

Thanks that's work!

And don't forget to delete or comment these on Main.Activity.com

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hi Adin,

in the manifest file you should see this:

 <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"> // you will need to change the style "AppTheme"

go to the main folder, then res folder, then values ... inside the values folder you should see the styles folder ... GO INSIDE :)

change

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

Let me know if that works

Grigorij

Adin Lopez
Adin Lopez
2,272 Points

thanks for the answer!, but i already try that and nothing happens

my code look like this

this is in styles.xml

<div class = "highlight highlight-java">

<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>

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

<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"/>

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>

</resources>

this is the top bar i want to eliminate

Élvio Sousa
Élvio Sousa
4,452 Points

Hi there,

You need to change your activity_main.xml and delete some lines of code. Here is my code. Basically in only need to include the content_main.

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
    tools:context="com.elviosousa.interactivestory.MainActivity">

    <include layout="@layout/content_main" />

</android.support.design.widget.CoordinatorLayout>