设置锁屏时壁纸(不包括桌面壁纸)
private void setLockWallPaper() {
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
try {
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.raw.wallpaper);
wallpaperManager.setBitmap(bitmap, null, true, WallpaperManager.FLAG_LOCK); // 主要由FLAG_LOCK来限定为锁屏壁纸
} catch (Exception e) {
e.printStackTrace();
}
}
清除/还原壁纸
wallpaperManager.clearWallpaper();