简体   繁体   English

以编程方式设置 Android 设备的锁屏壁纸

[英]Set lock screen wallpaper of Android device programmatically

There is bunch of wallpaper applications where you can change lock screen wallpaper separate from main wallpaper.有许多壁纸应用程序,您可以在其中更改与主壁纸分开的锁屏壁纸。 If I am not mistaken from API 24 it is possible to do such kind of thing, but I find very few articles related to this besides they are TOO old.如果我没有从API 24弄错的话,可以做这样的事情,但是我发现很少有与此相关的文章,而且它们太旧了。

WallpaperManager has a number of methods to help you get or set the specific wallpapers. WallpaperManager有许多方法可以帮助您获取或设置特定的壁纸。 As you want the lock screen wallpaper, use FLAG_LOCK .如果您想要锁屏壁纸,请使用FLAG_LOCK Relevant methods include:相关方法包括:

getWallpaperFile(int)

setBitmap(Bitmap fullImage, Rect visibleCropHint, boolean allowBackup, int which)

wallpaperManager.setBitmap(bitmap, null, true, WallpaperManager.FLAG_LOCK)

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

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