共用方式為


Resources.GetQuantityText(Int32, Int32) Method

Definition

Returns the character sequence necessary for grammatically correct pluralization of the given resource ID for the given quantity.

public string GetQuantityText (int id, int quantity);
member this.GetQuantityText : int * int -> string

Parameters

id
Int32

The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier.

quantity
Int32

The number used to get the correct string for the current language's plural rules.

Returns

CharSequence The string data associated with the resource, plus possibly styled text information.

Remarks

Returns the character sequence necessary for grammatically correct pluralization of the given resource ID for the given quantity. Note that the character sequence is selected based solely on grammatical necessity, and that such rules differ between languages. Do not assume you know which string will be returned for a given quantity. See String Resources for more detail.

Java documentation for android.content.res.Resources.getQuantityText(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