我想通过代码在Android中自动设置动态壁纸,而不需要任何用于壁纸选择的用户界面。
可以通过代码自动设置简单的壁纸设置:
final WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
final Drawable wallpaperDrawable = wallpaperManager.getDrawable();
final ImageView imageView = (ImageView) findViewById(R.id.imageview);
imageView.setDrawingCacheEnabled(true);
imageView.setImageDrawable(wallpaperDrawable);
现在我必须使用服务自动设置动态壁纸,以便每天在屏幕上自动设置动态壁纸。
我该怎么做?
最佳答案
Android 操作系统不允许您以编程方式设置动态壁纸。您只能对静态壁纸执行此操作。您可以获得的最接近的是使用此方法:Setting live wallpaper programmatically .
关于android - 通过代码设置Android动态壁纸,无需用户交互,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10006826/