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

Nishant Jee
Nishant Jee
844 Points

Unable to remove Action Bar. Below is the Code that i have used.



<!-- 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 name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>

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

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


styles.xml(v21) :-


<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:statusBarColor">@android:color/transparent</item>


In the content.xml i have selected the theme AppTheme.NoActionBar

Still not able to remove the action bar. Please help.


2 Answers

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

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

chris linder
chris linder
5,921 Points

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

replace with

<style name="AppTheme.AppBarOverlay" parent="Base.ThemeOverlay.AppCompat.DarkNoActionBar" />