我想获取手机的当前墙纸并将该图像设置为应用程序的背景图像。我尝试过这种方式,但显示运行时异常

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

最佳答案

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

关于android - 如何将当前壁纸设置为我的应用背景图片Android?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19336477/

10-10 14:39