Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heinrichreimer/a6c4b04cf77631857e50 to your computer and use it in GitHub Desktop.
Save heinrichreimer/a6c4b04cf77631857e50 to your computer and use it in GitHub Desktop.
Use android wallpaper as activity background
<resources>
<style name="Configuration.Theme" parent="Configuration.Theme.Base">
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowShowWallpaper">true</item>
<item name="android:windowBackground">#1000</item>
</style>
</resources>
@dev-wanjihia
Copy link

thank you.

@dgadelha
Copy link

dgadelha commented Aug 1, 2018

Thanks!

@RenaKunisaki
Copy link

It didn't work for me (Android 9), but I managed to fix it:

In styles.xml add to the style tag:

<item name="android:windowShowWallpaper">true</item>
<item name="android:windowBackground">@color/colorBackground</item>

and in colors.xml add to the resources tag:

<color name="colorBackground">#00000080</color>

My full styles.xml (yours will be different):

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        <item name="android:windowShowWallpaper">true</item>
        <item name="android:windowBackground">@color/colorBackground</item>
    </style>

</resources>

and colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#009DF3</color>
    <color name="colorPrimaryDark">#006DC3</color>
    <color name="colorAccent">#00FFFF</color>
    <color name="colorBackground">#00000080</color>
</resources>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment