简体   繁体   English

如何将当前壁纸设置为我的应用背景图片Android?

[英]how set current wallpaper as my application background image Android?

I want to get mobile`s current wallpaper and set that image as the background image of the application. 我想获取手机的当前墙纸并将该图像设置为应用程序的背景图像。 I tried this way but its show a run time exception 我尝试过这种方式,但显示运行时异常

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM