-1

I want to make 100% translucent status bar in android so that it should show the image below it clearly. Image Attached.

I have set the following theme to my activity :

<resources>

    <style name="AppThemeT" parent="Theme.AppCompat.Light">
        <item name="android:windowDrawsSystemBarBackgrounds">true</item>
        <item name="android:statusBarColor">@color/transparent</item>
        <item name="android:windowTranslucentStatus">true</item>

    </style>
</resources>

But it is giving a weird gray colored shadow on the top. check attached image. I want to remove that shadow. enter image description here

Gaurav Arora
  • 8,282
  • 21
  • 88
  • 143

4 Answers4

3

apply this theme to your layout root

<style name="AppTheme.Transparent">
    <item name="android:windowTranslucentStatus">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
</style>

And this back in your java activity file:

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    }
guisantogui
  • 4,017
  • 9
  • 49
  • 93
0

Add this code in your onCreate();

getWindow().getDecorView().setSystemUiVisibility(
        View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
Ergin Ersoy
  • 890
  • 8
  • 28
Levon Petrosyan
  • 8,815
  • 8
  • 54
  • 65
0

Use Immersive view to remove that. You can learn form here

Lcukerd
  • 438
  • 6
  • 21
0

In your styles.xml, you add below lines.

<!-- 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>

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

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

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

create styles.xml for v21 and it should look like below:

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

and in your manifest file you need to define your application theme:

<application
    android:theme="@style/AppTheme"

also you need to define activity theme in your manifest file

<activity
    android:theme="@style/AppTheme.NoActionBar"
Ergin Ersoy
  • 890
  • 8
  • 28