Partager via


NumberFormatterSettings.PerUnit(MeasureUnit) Method

Definition

Sets a unit to be used in the denominator.

[Android.Runtime.Register("perUnit", "(Landroid/icu/util/MeasureUnit;)Landroid/icu/number/NumberFormatterSettings;", "GetPerUnit_Landroid_icu_util_MeasureUnit_Handler", ApiSince=30)]
public virtual Java.Lang.Object? PerUnit (Android.Icu.Util.MeasureUnit? perUnit);
[<Android.Runtime.Register("perUnit", "(Landroid/icu/util/MeasureUnit;)Landroid/icu/number/NumberFormatterSettings;", "GetPerUnit_Landroid_icu_util_MeasureUnit_Handler", ApiSince=30)>]
abstract member PerUnit : Android.Icu.Util.MeasureUnit -> Java.Lang.Object
override this.PerUnit : Android.Icu.Util.MeasureUnit -> Java.Lang.Object

Parameters

perUnit
MeasureUnit

The unit to render in the denominator.

Returns

The fluent chain

Attributes

Remarks

Sets a unit to be used in the denominator. For example, to format "3 m/s", pass METER to the unit and SECOND to the perUnit.

Pass this method any instance of MeasureUnit. For example:

NumberFormatter.with().unit(MeasureUnit.METER).perUnit(MeasureUnit.SECOND)

The default is not to display any unit in the denominator.

If a per-unit is specified without a primary unit via #unit, the behavior is undefined.

Java documentation for android.icu.number.NumberFormatterSettings.perUnit(android.icu.util.MeasureUnit).

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