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