語言

Preference 建構函式

定義

多載

名稱 Description
Preference(Context)

建構子來建立偏好。

Preference(Context, IAttributeSet)

從 XML 膨脹偏好設定時所呼叫的建構子。

Preference(IntPtr, JniHandleOwnership)

用於建立 JNI 物件受管理表示的建構器;由執行時呼叫。

Preference(Context, IAttributeSet, Int32)

從 XML 進行膨脹,並套用類別特定的基底樣式。

Preference(Context, IAttributeSet, Int32, Int32)

從 XML 進行膨脹,並套用類別特定的基底樣式。

Preference(Context)

建構子來建立偏好。

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")]
public Preference(Android.Content.Context? context);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;)V", "")>]
new Android.Preferences.Preference : Android.Content.Context -> Android.Preferences.Preference

參數

context
Context

儲存偏好值的上下文。

屬性

備註

建構子來建立偏好。

Java 文件 android.preference.Preference.Preference(android.content.Context)。

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

適用於

Preference(Context, IAttributeSet)

從 XML 膨脹偏好設定時所呼叫的建構子。

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "")]
public Preference(Android.Content.Context? context, Android.Util.IAttributeSet? attrs);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;)V", "")>]
new Android.Preferences.Preference : Android.Content.Context * Android.Util.IAttributeSet -> Android.Preferences.Preference

參數

context
Context

這個上下文是它所關聯的,透過它可以存取當前主題、資源等 SharedPreferences。

attrs
IAttributeSet

就是那個讓偏好設定膨脹的 XML 標籤屬性。

屬性

備註

從 XML 膨脹偏好設定時所呼叫的建構子。 當從 XML 檔案建構偏好設定時,會呼叫該偏好設定,並提供 XML 檔案中指定的屬性。 此版本預設風格為 0,因此僅套用 Context's Theme 與給定屬性集的屬性值。

Java 文件 android.preference.Preference.Preference(android.content.Context, android.util.AttributeSet)。

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

另請參閱

  • <xref:Android.Preferences.Preference(Android.Content.Context%2c+Android.Util.IAttributeSet%2c+Android.Util.IAttributeSet)>

適用於

Preference(IntPtr, JniHandleOwnership)

用於建立 JNI 物件受管理表示的建構器;由執行時呼叫。

protected Preference(IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Preferences.Preference : nativeint * Android.Runtime.JniHandleOwnership -> Android.Preferences.Preference

參數

javaReference
IntPtr

nativeint

IntPtrA 包含一個 Java 原生介面(JNI)物件參考。

transfer
JniHandleOwnership

JniHandleOwnershipA 指示如何處理javaReference

備註

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

適用於

Preference(Context, IAttributeSet, Int32)

從 XML 進行膨脹,並套用類別特定的基底樣式。

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "")]
public Preference(Android.Content.Context? context, Android.Util.IAttributeSet? attrs, int defStyleAttr);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;I)V", "")>]
new Android.Preferences.Preference : Android.Content.Context * Android.Util.IAttributeSet * int -> Android.Preferences.Preference

參數

context
Context

這個上下文是它所關聯的,透過它可以存取當前主題、資源等 SharedPreferences。

attrs
IAttributeSet

就是那個讓偏好設定膨脹的 XML 標籤屬性。

defStyleAttr
Int32

目前主題中的一個屬性,包含對提供該視圖預設值的樣式資源的參考。 可以是0,不用找預設值。

屬性

備註

從 XML 進行膨脹,並套用類別特定的基底樣式。 這個偏好的構造允許子職業在膨脹時使用自己的基礎風格。 例如,建CheckBoxPreference構子呼叫此版本的超類別建構子,並提供 android.R.attr.checkBoxPreferenceStyle var>defStyleAttr<</var>。 這允許主題的核取方塊偏好設定樣式修改所有基礎偏好屬性以及 CheckBoxPreference 類別的屬性。

Java 文件 android.preference.Preference.Preference(android.content.Context, android.util.AttributeSet, int)。

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

另請參閱

  • <xref:Android.Preferences.Preference(Android.Content.Context%2c+Android.Util.IAttributeSet)>

適用於

Preference(Context, IAttributeSet, Int32, Int32)

從 XML 進行膨脹,並套用類別特定的基底樣式。

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;II)V", "")]
public Preference(Android.Content.Context? context, Android.Util.IAttributeSet? attrs, int defStyleAttr, int defStyleRes);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;II)V", "")>]
new Android.Preferences.Preference : Android.Content.Context * Android.Util.IAttributeSet * int * int -> Android.Preferences.Preference

參數

context
Context

這個上下文是它所關聯的,透過它可以存取當前主題、資源等 SharedPreferences。

attrs
IAttributeSet

就是那個讓偏好設定膨脹的 XML 標籤屬性。

defStyleAttr
Int32

目前主題中的一個屬性,包含對提供該視圖預設值的樣式資源的參考。 可以是0,不用找預設值。

defStyleRes
Int32

一個樣式資源的資源識別碼,提供該視圖的預設值,僅在 defStyleAttr 為 0 或無法在主題中找到時使用。 可以是0,不用找預設值。

屬性

備註

從 XML 進行膨脹,並套用類別特定的基底樣式。 這個偏好的構造允許子職業在膨脹時使用自己的基礎風格。 例如,建CheckBoxPreference構子呼叫此版本的超類別建構子,並提供 android.R.attr.checkBoxPreferenceStyle var>defStyleAttr<</var>。 這允許主題的核取方塊偏好設定樣式修改所有基礎偏好屬性以及 CheckBoxPreference 類別的屬性。

Java 文件 android.preference.Preference.Preference(android.content.Context, android.util.AttributeSet, int, int)。

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

另請參閱

  • <xref:Android.Preferences.Preference(Android.Content.Context%2c+Android.Util.IAttributeSet)>

適用於