語言

WallpaperService.Engine.OnComputeColors 方法

定義

系統需要知道壁紙使用的顏色時會呼叫它。

[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

傳回

壁紙顏色。

屬性

備註

系統需要知道壁紙使用的顏色時會呼叫它。 如果目前沒有顏色資訊,你可以回傳 null。 這種情況下,等顏色資訊有消息時,你可能想打電話 #notifyColorsChanged() 問清楚。

建立 android.app.WallpaperColors 物件最簡單的方法是使用 android.app.WallpaperColors#fromBitmap(Bitmap) 或 android.app.WallpaperColors#fromDrawable(Drawable),但你也可以手動建構 android.app.WallpaperColors 物件來指定主色。

Java 文件 android.service.wallpaper.WallpaperService.Engine.onComputeColors()。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於