Preference Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Preference(Context) |
Constructor to create a Preference. |
Preference(Context, IAttributeSet) |
Constructor that is called when inflating a Preference from XML. |
Preference(IntPtr, JniHandleOwnership) |
A constructor used when creating managed representations of JNI objects; called by the runtime. |
Preference(Context, IAttributeSet, Int32) |
Perform inflation from XML and apply a class-specific base style. |
Preference(Context, IAttributeSet, Int32, Int32) |
Perform inflation from XML and apply a class-specific base style. |
Preference(Context)
Constructor to create a Preference.
[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
Parameters
- context
- Context
The Context in which to store Preference values.
- Attributes
Remarks
Constructor to create a Preference.
Java documentation for android.preference.Preference.Preference(android.content.Context)
.
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
Preference(Context, IAttributeSet)
Constructor that is called when inflating a Preference from 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
Parameters
- context
- Context
The Context this is associated with, through which it can
access the current theme, resources, SharedPreferences
,
etc.
- attrs
- IAttributeSet
The attributes of the XML tag that is inflating the preference.
- Attributes
Remarks
Constructor that is called when inflating a Preference from XML. This is called when a Preference is being constructed from an XML file, supplying attributes that were specified in the XML file. This version uses a default style of 0, so the only attribute values applied are those in the Context's Theme and the given AttributeSet.
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.
See also
- <xref:Android.Preferences.Preference(Android.Content.Context%2c+Android.Util.IAttributeSet%2c+Android.Util.IAttributeSet)>
Applies to
Preference(IntPtr, JniHandleOwnership)
A constructor used when creating managed representations of JNI objects; called by the runtime.
protected Preference (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Preferences.Preference : nativeint * Android.Runtime.JniHandleOwnership -> Android.Preferences.Preference
Parameters
- transfer
- JniHandleOwnership
A JniHandleOwnershipindicating how to handle javaReference
Remarks
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
Preference(Context, IAttributeSet, Int32)
Perform inflation from XML and apply a class-specific base style.
[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
Parameters
- context
- Context
The Context this is associated with, through which it can
access the current theme, resources,
SharedPreferences
, etc.
- attrs
- IAttributeSet
The attributes of the XML tag that is inflating the preference.
- defStyleAttr
- Int32
An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.
- Attributes
Remarks
Perform inflation from XML and apply a class-specific base style. This constructor of Preference allows subclasses to use their own base style when they are inflating. For example, a CheckBoxPreference
constructor calls this version of the super class constructor and supplies android.R.attr.checkBoxPreferenceStyle
for <var>defStyleAttr</var>. This allows the theme's checkbox preference style to modify all of the base preference attributes as well as the CheckBoxPreference
class's attributes.
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.
See also
- <xref:Android.Preferences.Preference(Android.Content.Context%2c+Android.Util.IAttributeSet)>
Applies to
Preference(Context, IAttributeSet, Int32, Int32)
Perform inflation from XML and apply a class-specific base style.
[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
Parameters
- context
- Context
The Context this is associated with, through which it can
access the current theme, resources,
SharedPreferences
, etc.
- attrs
- IAttributeSet
The attributes of the XML tag that is inflating the preference.
- defStyleAttr
- Int32
An attribute in the current theme that contains a reference to a style resource that supplies default values for the view. Can be 0 to not look for defaults.
- defStyleRes
- Int32
A resource identifier of a style resource that supplies default values for the view, used only if defStyleAttr is 0 or can not be found in the theme. Can be 0 to not look for defaults.
- Attributes
Remarks
Perform inflation from XML and apply a class-specific base style. This constructor of Preference allows subclasses to use their own base style when they are inflating. For example, a CheckBoxPreference
constructor calls this version of the super class constructor and supplies android.R.attr.checkBoxPreferenceStyle
for <var>defStyleAttr</var>. This allows the theme's checkbox preference style to modify all of the base preference attributes as well as the CheckBoxPreference
class's attributes.
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.
See also
- <xref:Android.Preferences.Preference(Android.Content.Context%2c+Android.Util.IAttributeSet)>