Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/200.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何用代码更改android中的锁屏壁纸?_Android - Fatal编程技术网

如何用代码更改android中的锁屏壁纸?

如何用代码更改android中的锁屏壁纸?,android,Android,我可以更改主屏幕壁纸,但无法更改锁屏壁纸, DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); // get the height and width of screen int height = metric

我可以更改主屏幕壁纸,但无法更改锁屏壁纸,

                DisplayMetrics metrics = new DisplayMetrics();
                getWindowManager().getDefaultDisplay().getMetrics(metrics);
                // get the height and width of screen
                int height = metrics.heightPixels;
                int width = metrics.widthPixels;

                WallpaperManager wallpaperManager = WallpaperManager
                        .getInstance(getApplicationContext());

                wallpaperManager.setBitmap(bitmap);


                wallpaperManager.suggestDesiredDimensions(width, height);

从最新的Android API 24开始,可以通过使用
wallparkmanager
并提供
FLAG\u LOCK
标志来更新
Lockscreen
壁纸

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

这是我的工作,但不是在棉花糖phone@RobbyPatel如前所述,这是在API 24中添加的(因此在API 24之前的android版本中不提供),并且永远不会有支持,但是一些三星手机提供了锁屏壁纸,它是如何工作的?因为三星正在修改SystemUI,他们可以做任何他们想做的事情。但是他们没有通过android SDK提供API,允许您更改我的设备版本是24,它不工作