如何设置当前壁纸作为我的应用程序背景图像Android?

时间:2013-10-12 16:20:05

标签: android background wallpaper

我想获得移动设备的当前壁纸并将该图像设置为应用程序的背景图像。我试过这种方式,但它显示运行时异常

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

1 个答案:

答案 0 :(得分:1)

 final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
 final Drawable wallpaperDrawable = wallpaperManager.getFastDrawable();
 getWindow().setBackgroundDrawable(wallpaperDrawable);