How to make a transparent status bar in Android 4.4?

I want to create a transparent status bar in my application in Android 4.4. How to do it?

I'm tired:

<style name="AppTheme" parent="@style/Theme.AppCompat.Light.NoActionBar"> <item name="colorPrimary">@color/skipPrimary</item> <item name="colorPrimaryDark">@color/skipPrimary</item> <item name="colorAccent">@color/skipPrimary</item> </style> 

and in the manifest:

 <application android:name=".App" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:theme="@style/AppTheme" > 

and in action:

 <activity android:name=".activities.StartActivity" android:configChanges="orientation|keyboardHidden|keyboard|screenSize" android:screenOrientation="portrait" android:theme="@style/AppTheme" android:windowSoftInputMode="adjustResize|stateHidden" /> 
0
source share
2 answers

This will throw an exception on Lollipop devices. primColor should be opaque.

 <item name="primColor">@android:color/transparent</item> 

Customize your action bar with style.xml

 <style name="ThemeActionBar" parent="Widget.AppCompat.Light.ActionBar.Solid"> <item name="android:background">@null</item> <!-- Support library compatibility --> <item name="background">@null</item> </style> 

Turn on the theme.

 <item name="android:actionBarStyle">@style/ThemeActionBar</item> <item name="android:windowActionBarOverlay">true</item> <!-- Support library compatibility --> <item name="actionBarStyle">@style/ThemeActionBar</item> <item name="windowActionBarOverlay">true</item> 
0
source

What you can also do is set the status bar to a darker shade of your background or even one color, setting it in your activity.

You can set the color of the status bar in your activity using the following getWindow().setStatusBarColor(getResources().getColor(R.color.your_color)); code getWindow().setStatusBarColor(getResources().getColor(R.color.your_color)); .

If you want to use a darker shade of your color, you can do this by changing the HSB color. For a more detailed way to do this, you can read this post: Android status bar color will change by converting existing HSB color

0
source

All Articles