Partager via


WallpaperService.Engine.OnComputeColors Method

Definition

Called by the system when it needs to know what colors the wallpaper is using.

[Android.Runtime.Register("onComputeColors", "()Landroid/app/WallpaperColors;", "GetOnComputeColorsHandler", ApiSince=27)]
public virtual Android.App.WallpaperColors? OnComputeColors ();
[<Android.Runtime.Register("onComputeColors", "()Landroid/app/WallpaperColors;", "GetOnComputeColorsHandler", ApiSince=27)>]
abstract member OnComputeColors : unit -> Android.App.WallpaperColors
override this.OnComputeColors : unit -> Android.App.WallpaperColors

Returns

Wallpaper colors.

Attributes

Remarks

Called by the system when it needs to know what colors the wallpaper is using. You might return null if no color information is available at the moment. In that case you might want to call #notifyColorsChanged() when color information becomes available.

The simplest way of creating a android.app.WallpaperColors object is by using android.app.WallpaperColors#fromBitmap(Bitmap) or android.app.WallpaperColors#fromDrawable(Drawable), but you can also specify your main colors by constructing a android.app.WallpaperColors object manually.

Java documentation for android.service.wallpaper.WallpaperService.Engine.onComputeColors().

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