java.lang.Object
↳android.app.WallpaperManager
Class Overview(类概述)
Provides access to the system wallpaper. With WallpaperManager, you can get the current wallpaper, get the desired dimensions for the wallpaper, set the wallpaper, and more. Get an instance of WallpaperManager with getInstance()
.
提供系统壁纸访问。使用该类,你可以获得当前壁纸,获得壁纸所需尺寸,设置壁纸等等。用getInstance函数来获得该类的一个实例。
Summary(摘要)
Constants(常量)
String ACTION_LIVE_WALLPAPER_CHOOSER
Launch an activity for the user to pick the current global live wallpaper.
启动一个选择当前全局动态壁纸的Activity
String COMMAND_DROP
Command for sendWallpaperCommand(IBinder, String, int, int, int, Bundle): reported by the wallpaper host when the user drops an object into an area of the host.
当用户拖动一个object到host区域时,
String COMMAND_SECONDARY_TAP
Command for sendWallpaperCommand(IBinder, String, int, int, int, Bundle): reported by the wallpaper host when the user releases a secondary pointer on an empty area (not performing an action in the host).
当用户释放一个xxx在空白区域时,(不在host显示动画效果)
String COMMAND_TAP
Command for sendWallpaperCommand(IBinder, String, int, int, int, Bundle): reported by the wallpaper host when the user taps on an empty area (not performing an action in the host).
当用户点击空白区域时,
String WALLPAPER_PREVIEW_META_DATA
Manifest entry for activities that respond to ACTION_SET_WALLPAPER which allows them to provide a custom large icon associated with this action.
Public Methods(公开函数)
void clear()
Remove any currently set wallpaper, reverting to the system's default wallpaper.
清除当前设置的壁纸,还原成系统默认的壁纸
void clearWallpaperOffsets(IBinder windowToken)
Clear the offsets previously associated with this window through setWallpaperOffsets(IBinder, float, float).
清除setWallpaperOffsets设置的内容
int getDesiredMinimumHeight()
Returns the desired minimum height for the wallpaper.
返回要求的最小壁纸高度
int getDesiredMinimumWidth()
Returns the desired minimum width for the wallpaper.
返回要求的最小壁纸宽度
Drawable getDrawable()
Retrieve the current system wallpaper; if no wallpaper is set, the system default wallpaper is returned.
重新获得当前系统壁纸,如果没有设置过壁纸,则返回默认系统壁纸。
Drawable getFastDrawable()
Like getDrawable(), but the returned Drawable has a number of limitations to reduce its overhead as much as possible.
跟GetDrawable函数一样,不过返回的Drawable有一定的限制,尽量减少它的总开销。
static WallpaperManager getInstance(Context context)
Retrieve a WallpaperManager associated with the given Context.
根据给定的Context获得WallpaperManager实例
WallpaperInfo getWallpaperInfo()
If the current wallpaper is a live wallpaper component, return the information about that wallpaper.
如果当前壁纸是动态壁纸,则返回动态壁纸信息。
这里还少写了一句,如果不是动态壁纸的话则返回null,可依此来判断当前壁纸是动态还是静态的。
Drawable peekDrawable()
Retrieve the current system wallpaper; if there is no wallpaper set, a null pointer is returned.
获得当前系统壁纸,如果壁纸未设置则返回null
Drawable peekFastDrawable()
Like getFastDrawable(), but if there is no wallpaper set, a null pointer is returned.
跟getFastDrawable函数一样,但是该函数如果没有设置壁纸则返回null。
void sendWallpaperCommand(IBinder windowToken, String action, int x, int y, int z, Bundle extras)
Send an arbitrary command to the current active wallpaper.
发送任意指令到当前活动的壁纸程序
void setBitmap(Bitmap bitmap)
Change the current system wallpaper to a bitmap.
设置当前壁纸
void setResource(int resid)
Change the current system wallpaper to the bitmap in the given resource.
设置当前壁纸
void setStream(InputStream data)
Change the current system wallpaper to a specific byte stream.
设置当前壁纸
void setWallpaperOffsetSteps(float xStep, float yStep)
For applications that use multiple virtual screens showing a wallpaper, specify the step size between virtual screens.
如果程序使用多个虚拟屏幕来显示壁纸,指定虚拟屏幕之间的步长,其实就是设置壁纸需要几屏来显示。
yStep为1.0f,xStep为1.0f/(屏数-1)。所以如果你只有一屏,在设置这里的时候要注意了。
void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset)
Set the position of the current wallpaper within any larger space, when that wallpaper is visible behind the given window.
当壁纸显示在给定窗口下方时,设置当前壁纸的位置,这个就不是很明白,理论上说不是应该从左上角开始嘛?
void suggestDesiredDimensions(int minimumWidth, int minimumHeight)
For use only by the current home application, to specify the size of wallpaper it would like to use.
仅仅为了给主应用使用,用来指定壁纸的尺寸
[Expand]
Inherited Methods(继承函数)
From class java.lang.Object