如果当前用户不支持如果当前 WallpaperManager

public class WallpaperManager
extendsObject

java.lang.Object
android.app.WallpaperManager

added in API level 5.


提供对系统壁纸的访问. 使用WallpaperManager, 你就可以获取当前的壁纸, 获得所需的壁纸的尺寸, 设置壁纸, 以及更多的操作. 使用WallpaperManager 的getInstance() 方法获取它的实例 .

通过调用 isWallpaperSupported(), 应用程序可以检查当前用户是否支持壁纸, 调用isSetWallpaperAllowed()来检测当前用户是否拥有设置壁纸的权限.

常量


ACTION_CHANGE_LIVE_WALLPAPER

added in API level 16.

String ACTION_CHANGE_LIVE_WALLPAPER

Directly launch live wallpaper preview, allowing the user to immediately confirm to switch to a specific live wallpaper. You must specify EXTRA_LIVE_WALLPAPER_COMPONENT with the ComponentName of a live wallpaper component that is to be shown.

Constant Value: "android.service.wallpaper.CHANGE_LIVE_WALLPAPER"

公用方法


getWallpaperInfo

added in API level 7.

WallpaperInfo getWallpaperInfo ()

如果当前的壁纸是一个动态壁纸组件, 返回有关该壁纸的信息. 如果是其他类型的壁纸, 如果是它只是一张静态图片, 简单的返回null.

返回值
WallpaperInfo

getDrawable

added in API level 5.

Drawable getDrawable ()

获取当前系统壁纸; 如果没有设置壁纸, 将返回系统内置的静态壁纸. 这作为抽象的Drawable返回,您可以在View中安装以显示用户当前设置的任何壁纸。

如果系统中没有任何有效的壁纸就返回null, 如果当前用户不支持壁纸, 或者调用这个方法的app没有访问壁纸的权限也返回null.

返回值
Drawable 返回绘制系统壁纸的Drawable对象, 如果系统中没有壁纸, 或者没有访问系统壁纸的权限, 则返回null.

results matching ""

    No results matching ""