3

I'm new to android and one of my activities does not require the Action Bar but I'd like to keep the Status Bar. I have this style:

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

This removes the Action Bar as expected and the Status Bar is there but now it's unreadable (white icons on an off-white background). How can I fix this? I'd be fine with changing the background of the Status Bar to black. Minimum SDK 19

Andrew
  • 175
  • 1
  • 2
  • 12

3 Answers3

2

For everyone looking for a solution, here's one :

In your styles.xml add this :

<style name="AppTheme.OnlyStatusBar">
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowFullscreen">true</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:statusBarColor">#FF000000</item>
    </style>

Then in your AndroidManifest.xml, for the choosen activity, add this :

<activity
            ...
            android:theme="@style/AppTheme.OnlyStatusBar">
           ...
</activity>

It will be showing the windows without any action Bar and still with the status bar. That's all, ez pz :) !

Mayoul
  • 626
  • 10
  • 24
1

That is normal because the background is light and it's like a FullScreen Activity and the icons or other things are not readable.

In the new android, there is a new feature to do that(in values-v23/styles.xml):

<item name="android:windowLightStatusBar">true</item>

See: How to change the status bar notification icons' color/tint in android (marshmallow and above 23+)?

Community
  • 1
  • 1
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108
0

Well if you're using Android Studio, nowadays you have an option to create FullscreenActivity, that it doesn't include the ActionBar:

File -> New -> Activity -> Fullscreeen Activity
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108