I want to use the wallpaper background from the main page in the application, I found that they used to do it this way:

android:theme="@android:style/Theme.Wallpaper" 

I set in style:

 <item name="android:windowBackground">@android:theme="android:style/Theme.Wallpaper"</item> 

After that there is an error in the application. Is it really impossible to do this through styles and need to change the whole topic? or now it does not work?

PS It is clear that this is not correct as I do not have the Theme.Wallpaper style. I ask you to suggest how to use the picture from the desktop.

  • And if in this attribute and in android:background set just transparent color @android:color/transparent ? - Yuriy SPb ♦
  • @ YuriySPb instead of the background, the launcher or the previous application will be visible, I think the author of the question does not want this - xkor

2 answers 2

Here they write that you can get Drawable wallpapers like this:

 final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this); final Drawable wallpaperDrawable = wallpaperManager.getDrawable(); 

    Through styles you can either inherit from Theme.Wallpaper :

      <style name="AppTheme" parent="android:Theme.Wallpaper" /> 

    or customize used:

     <style name="AppTheme" > <item name="android:windowBackground">@android:color/transparent</item> <item name="android:colorBackgroundCacheHint">@null</item> <item name="android:windowShowWallpaper">true</item> </style>