共用方式為


WallpaperManager.GetDrawable(WallpaperManagerFlags) Method

Definition

<strong> Important note: </strong> only apps with android.Manifest.permission#MANAGE_EXTERNAL_STORAGE should use this method.

[Android.Runtime.Register("getDrawable", "(I)Landroid/graphics/drawable/Drawable;", "GetGetDrawable_IHandler", ApiSince=34)]
public virtual Android.Graphics.Drawables.Drawable? GetDrawable (Android.App.WallpaperManagerFlags which);
[<Android.Runtime.Register("getDrawable", "(I)Landroid/graphics/drawable/Drawable;", "GetGetDrawable_IHandler", ApiSince=34)>]
abstract member GetDrawable : Android.App.WallpaperManagerFlags -> Android.Graphics.Drawables.Drawable
override this.GetDrawable : Android.App.WallpaperManagerFlags -> Android.Graphics.Drawables.Drawable

Parameters

which
WallpaperManagerFlags

The FLAG_* identifier of a valid wallpaper type. Throws IllegalArgumentException if an invalid wallpaper is requested.

Returns

A Drawable object for the requested wallpaper.

Attributes

Remarks

<strong> Important note: </strong> only apps with android.Manifest.permission#MANAGE_EXTERNAL_STORAGE should use this method. Otherwise, a SecurityException will be thrown.

Retrieve the requested wallpaper for the specified wallpaper type if the wallpaper is not a live wallpaper. This method should not be used to display the user wallpaper on an app: android.view.WindowManager.LayoutParams#FLAG_SHOW_WALLPAPER should be used instead.

When called with which=#FLAG_SYSTEM, if there is a live wallpaper on home screen, the built-in default wallpaper is returned.

When called with which=#FLAG_LOCK, if there is a live wallpaper on lock screen, or if the lock screen and home screen share the same wallpaper engine, null is returned.

#getWallpaperInfo(int) can be used to determine whether there is a live wallpaper on a specified screen type.

Java documentation for android.app.WallpaperManager.getDrawable(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to