This method was deprecated
in API level O.
Do not use. This is not internationalized, and has known issues
with right-to-left text, languages that have more than one plural form, languages
that use a different character as a comma-like separator, etc.
Use listEllipsize(Context, List, String, TextPaint, float, int) instead.
Returns the original text if it fits in the specified width
given the properties of the specified Paint,
or, if it does not fit, a truncated
copy with ellipsis character added at the specified edge or center.
Returns the original text if it fits in the specified width
given the properties of the specified Paint,
or, if it does not fit, a copy with ellipsis character added
at the specified edge or center.
Returns the length that the specified CharSequence would have if
spaces and ASCII control characters were trimmed from the start and end,
as by trim().
Formats a list of CharSequences by repeatedly inserting the separator between them,
but stopping when the resulting sequence is too wide for the specified width.
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
This method was deprecated
in API level O.
Do not use. This is not internationalized, and has known issues
with right-to-left text, languages that have more than one plural form, languages
that use a different character as a comma-like separator, etc.
Use listEllipsize(Context, List, String, TextPaint, float, int) instead.
Converts a CharSequence of the comma-separated form "Andy, Bob,
Charles, David" that is too wide to fit into the specified width
into one like "Andy, Bob, 2 more".
Parameters
text
CharSequence: the text to truncate
p
TextPaint: the Paint with which to measure the text
avail
float: the horizontal width available for the text (in pixels)
oneMore
String: the string for "1 more" in the current locale
more
String: the string for "%d more" in the current locale
Returns a CharSequence concatenating the specified CharSequences,
retaining their spans if any.
If there are no parameters, an empty string will be returned.
If the number of parameters is exactly one, that parameter is returned as output, even if it
is null.
If the number of parameters is at least two, any null CharSequence among the parameters is
treated as if it was the string "null".
If there are paragraph spans in the source CharSequences that satisfy paragraph boundary
requirements in the sources but would no longer satisfy them in the concatenated
CharSequence, they may get extended in the resulting CharSequence or not retained.
void copySpansFrom (Spanned source,
int start,
int end,
Class kind,
Spannable dest,
int destoff)
Copies the spans from the region start...end in
source to the region
destoff...destoff+end-start in dest.
Spans in source that begin before start
or end after end but overlap this range are trimmed
as if they began at start or ended at end.
Debugging tool to print the spans in a CharSequence. The output will
be printed one span per line. If the CharSequence is not a Spanned,
then the entire string will be printed on a single line.
Returns the original text if it fits in the specified width
given the properties of the specified Paint,
or, if it does not fit, a truncated
copy with ellipsis character added at the specified edge or center.
Returns the original text if it fits in the specified width
given the properties of the specified Paint,
or, if it does not fit, a copy with ellipsis character added
at the specified edge or center.
If preserveLength is specified, the returned copy
will be padded with zero-width spaces to preserve the original
length and offsets instead of truncating.
If callback is non-null, it will be called to
report the start and end of the ellipsized range. TextDirection
is determined by the first strong directional character.
Replace instances of "^1", "^2", etc. in the
template CharSequence with the corresponding
values. "^^" is used to produce a single caret in
the output. Only up to 9 replacement values are supported,
"^10" will be produce the first replacement value followed by a
'0'.
Parameters
template
CharSequence: the input text containing "^1"-style
placeholder values. This object is not modified; a copy is
returned.
values
CharSequence: CharSequences substituted into the template. The
first is substituted for "^1", the second for "^2", and so on.
int getCapsMode (CharSequence cs,
int off,
int reqModes)
Determine what caps mode should be in effect at the current offset in
the text. Only the mode bits set in reqModes will be
checked. Note that the caps mode flags here are explicitly defined
to match those in InputType.
Parameters
cs
CharSequence: The text that should be checked for caps modes.
Locale: the Locale for which we want the layout direction. Can be null.
Returns
int
the layout direction. This may be one of:
LAYOUT_DIRECTION_LTR or
LAYOUT_DIRECTION_RTL.
Be careful: this code will need to be updated when vertical scripts will be supported
This method was deprecated
in API level 24.
Do not use.
This function only reverses individual chars and not their associated
spans. It doesn't support surrogate pairs (that correspond to non-BMP code points), combining
sequences or conjuncts either.
Returns the length that the specified CharSequence would have if
spaces and ASCII control characters were trimmed from the start and end,
as by trim().
Formats a list of CharSequences by repeatedly inserting the separator between them,
but stopping when the resulting sequence is too wide for the specified width.
This method actually tries to fit the maximum number of elements. So if "A, 11 more"
fits, "A, B, 10 more" doesn't fit, but "A, B, C, 9 more" fits again (due to
the glyphs for the digits being very wide, for example), it returns
"A, B, C, 9 more". Because of this, this method may be inefficient for very long
lists.
Note that the elements of the returned value, as well as the string for moreId, will
be bidi-wrapped using unicodeWrap(CharSequence) based on the locale of the input
Context. If the input Context is null, the default BidiFormatter from
getInstance() will be used.
Parameters
context
Context: the Context to get the moreId resource from. If null,
an ellipsis (U+2026) would be used for moreId.
This value may be null.
elements
List: the list to format
This value may be null.
separator
String: a separator, such as ", "
This value must never be null.
paint
TextPaint: the Paint with which to measure the text
This value must never be null.
avail
float: the horizontal width available for the text (in pixels)
Value is 0.0 or greater.
moreId
int: the resource ID for the pluralized string to insert at the end of sequence when
some of the elements don't fit.
Splits a string on a pattern. String.split() returns [''] when the string to be
split is empty. This returns []. This does not remove any empty strings from the result.
String.split() returns [''] when the string to be split is empty. This returns []. This does
not remove any empty strings from the result. For example split("a,", "," ) returns {"a", ""}.
Create a new String object containing the given range of characters
from the source string. This is different than simply calling
CharSequence.subSequence
in that it does not preserve any style runs in the source sequence,
allowing a more efficient implementation.
This site uses cookies to store your preferences for site-specific language and display options.
Get the latest Android developer news and tips that will help you find success on Google Play.
* Required Fields
Hooray!
You have successfully signed up for the latest Android developer news and tips.
Browse this site in ?
This class requires API level or higher
This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.