Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android styles.xml windowNoTitle (ActionBarActivity)

I want to hide the title bar (where the activity tile is shown) in my application. I'm doing this by setting the android:windowNoTitle item to true. This works fine for devices with API level 19. I tested it with a device running API level 10 and it only hides the notification bar. The tile bar is still shown.

Here is my res/values/styles.xml

<resources>
    <style name="AppBaseTheme" parent="Theme.AppCompat.Light">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
    </style>

</resources>

EDIT: I'm using the AppBaseTheme as the theme in my manifest. There are no other styles.xml files in any other value-vXX folder.

Edit#2: I'm extending an ActionBarActivity for my activity.

like image 512
Armin Avatar asked May 17 '14 07:05

Armin


Video Answer


2 Answers

I tried the android:style/Theme.NoTitleBar.Fullscreen in styles.xml but I got:

Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

So I followed the advise to stick to the AppCompat theme, and could hide statusbar and actionbar using the following lines in styles.xml:

<resources>
    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
    </style>
</resources>
like image 196
Avatar Avatar answered Sep 17 '22 14:09

Avatar


try using this

<style name="MyMaterialDialog" parent="Base.Theme.AppCompat.Light.Dialog.MinWidth">
    <item name="windowNoTitle">true</item>
    <item name="windowActionBar">false</item>
</style>

remove android prefix!

like image 42
ali Avatar answered Sep 18 '22 14:09

ali