我想获得移动设备的当前壁纸并将该图像设置为应用程序的背景图像。我试过这种方式,但它显示运行时异常
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
layout.setBackground(wallpaperDrawable);
答案 0 :(得分:1)
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getFastDrawable();
getWindow().setBackgroundDrawable(wallpaperDrawable);