共用方式為


Switch Constructors

Definition

Overloads

Switch(Context)

Construct a new Switch with default styling.

Switch(Context, IAttributeSet)

Construct a new Switch with default styling, overriding specific style attributes as requested.

Switch(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Switch(Context, IAttributeSet, Int32)

Construct a new Switch with a default style determined by the given theme attribute, overriding specific style attributes as requested.

Switch(Context, IAttributeSet, Int32, Int32)

Construct a new Switch with a default style determined by the given theme attribute or style resource, overriding specific style attributes as requested.

Switch(Context)

Construct a new Switch with default styling.

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

Parameters

context
Context

The Context that will determine this widget's theming.

Attributes

Remarks

Construct a new Switch with default styling.

Java documentation for android.widget.Switch.Switch(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

Switch(Context, IAttributeSet)

Construct a new Switch with default styling, overriding specific style attributes as requested.

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

Parameters

context
Context

The Context that will determine this widget's theming.

attrs
IAttributeSet

Specification of attributes that should deviate from default styling.

Attributes

Remarks

Construct a new Switch with default styling, overriding specific style attributes as requested.

Java documentation for android.widget.Switch.Switch(android.content.Context, android.util.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.

Applies to

Switch(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

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

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

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

Switch(Context, IAttributeSet, Int32)

Construct a new Switch with a default style determined by the given theme attribute, overriding specific style attributes as requested.

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

Parameters

context
Context

The Context that will determine this widget's theming.

attrs
IAttributeSet

Specification of attributes that should deviate from the default styling.

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

Construct a new Switch with a default style determined by the given theme attribute, overriding specific style attributes as requested.

Java documentation for android.widget.Switch.Switch(android.content.Context, android.util.AttributeSet, int).

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

Switch(Context, IAttributeSet, Int32, Int32)

Construct a new Switch with a default style determined by the given theme attribute or style resource, overriding specific style attributes as requested.

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Landroid/util/AttributeSet;II)V", "")]
public Switch (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.Widget.Switch : Android.Content.Context * Android.Util.IAttributeSet * int * int -> Android.Widget.Switch

Parameters

context
Context

The Context that will determine this widget's theming.

attrs
IAttributeSet

Specification of attributes that should deviate from the default styling.

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

Construct a new Switch with a default style determined by the given theme attribute or style resource, overriding specific style attributes as requested.

Java documentation for android.widget.Switch.Switch(android.content.Context, android.util.AttributeSet, int, int).

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