以编程方式设置动态壁纸 [英] Setting live wallpaper programmatically

查看:500
本文介绍了以编程方式设置动态壁纸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用一些代码行设置动态壁纸.例如,我想告诉我的用户,可以使用动态壁纸单击此处进行设置".

Is it possible to set a live wallpaper using some lines of code. For example, i want to tell my users that a live wallpaper is available "click here to set it".

推荐答案

好的,只是为了避免我对过时的答案投下反对票.有关更强大的解决方案,请参见下面的错误454的答案,该解决方案将使用户直接进入Jelly Bean和up设备上的墙纸预览屏幕.

Alright, just so I stop getting downvotes for an outdated answer. Please see Error 454's answer below for a more robust solution which will send the user directly to the wallpaper preview screen on Jelly Bean and up devices.

======================================

========================================

这是启动墙纸选择器的方法,用户可以从中选择墙纸.吐司只是向用户解释发生了什么情况的一种方式.

Here's how to start the wallpaper chooser, from which the user can select your wallpaper. The toast is just a way to explain to the user what's going on.

Toast toast = Toast.makeText(this, "Choose '<WALLPAPER NAME>' from the list to start the Live Wallpaper.",Toast.LENGTH_LONG);
toast.show();

Intent intent = new Intent();
intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
startActivity(intent);

这篇关于以编程方式设置动态壁纸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆