Language

RangeTemplate Constructors

Definition

Overloads

RangeTemplate(String, Single, Single, Single, Single, ICharSequence)

Construct a new RangeTemplate.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;FFFFLjava/lang/CharSequence;)V", "", ApiSince=30)]
public RangeTemplate(string templateId, float minValue, float maxValue, float currentValue, float stepValue, Java.Lang.ICharSequence? formatString);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;FFFFLjava/lang/CharSequence;)V", "", ApiSince=30)>]
new Android.Service.Controls.Templates.RangeTemplate : string * single * single * single * single * Java.Lang.ICharSequence -> Android.Service.Controls.Templates.RangeTemplate

Parameters

templateId
String

the identifier for this template object

minValue
Single

minimum value for the input

maxValue
Single

maximum value for the input

currentValue
Single

the current value of the Control containing this object.

stepValue
Single

minimum value of increments/decrements when interacting with this control.

formatString
ICharSequence

a formatting string as per String#format used to display the currentValue. If null is passed, the "%.1f" is used.

Attributes

Remarks

Construct a new RangeTemplate.

The range must be valid, meaning: <ul> <li> minValue<maxValue<li> minValue<currentValue<li> currentValue<maxValue<li> 0 <stepValue</ul>

The current value of the Control will be formatted accordingly.

Java documentation for android.service.controls.templates.RangeTemplate.RangeTemplate(java.lang.String, float, float, float, float, java.lang.CharSequence).

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

RangeTemplate(String, Single, Single, Single, Single, String)

Construct a new RangeTemplate.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;FFFFLjava/lang/CharSequence;)V", "", ApiSince=30)]
public RangeTemplate(string templateId, float minValue, float maxValue, float currentValue, float stepValue, string? formatString);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;FFFFLjava/lang/CharSequence;)V", "", ApiSince=30)>]
new Android.Service.Controls.Templates.RangeTemplate : string * single * single * single * single * string -> Android.Service.Controls.Templates.RangeTemplate

Parameters

templateId
String

the identifier for this template object. This value cannot be null.

minValue
Single

minimum value for the input

maxValue
Single

maximum value for the input

currentValue
Single

the current value of the Control containing this object.

stepValue
Single

minimum value of increments/decrements when interacting with this control.

formatString
String

a formatting string as per String.format used to display the currentValue. If null is passed, the "%.1f" is used.

Attributes

Remarks

The constructor uses Java Float.compare to check that minValue does not exceed maxValue and that currentValue is within those limits, including both endpoints. Equal limits are accepted when all three values compare equal. A failed range check or a zero or negative stepValue causes a IllegalArgumentException.

Java Float.compare orders negative zero below positive zero and NaN above all other values. The constructor does not separately require finite values. The step check uses stepValue <= 0, so it does not reject NaN.

The constructor stores formatString for display of the current value. It uses %.1f when the argument is null. It does not format the value or validate the format string in the constructor. The string uses Java formatting rules, not .NET composite formatting.

These limits are based on the constructor and validate() in the Android implementation, rather than the strict inequalities in its constructor Javadoc.

Applies to