語言

TypedArray.GetBoolean(Int32, Boolean) 方法

定義

在 var<index>/var< 處取得該屬性>的布林值。

[Android.Runtime.Register("getBoolean", "(IZ)Z", "GetGetBoolean_IZHandler")]
public virtual bool GetBoolean(int index, bool defValue);
[<Android.Runtime.Register("getBoolean", "(IZ)Z", "GetGetBoolean_IZHandler")>]
abstract member GetBoolean : int * bool -> bool
override this.GetBoolean : int * bool -> bool

參數

index
Int32

要檢索屬性的索引。

defValue
Boolean

若屬性未定義或無法強制轉換為整數,則回傳 值。

傳回

屬性的布林值,或若屬性未定義或無法強制為整數,則為 defValue。

屬性

例外狀況

如果 TypedArray 已經被回收過。

備註

在 var<index>/var< 處取得該屬性>的布林值。

若屬性為整數值,若屬性為零則回傳 false,若為 true,則為真。 若屬性非布林值或整數值,此方法將嘗試將其強制為整數,並 Integer#decode(String) 回傳是否等於零。

Java 文件 android.content.res.TypedArray.getBoolean(int, boolean)

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

適用於