public class SpannableString extends Object implements CharSequence, GetChars, Spannable
SpannableStringBuilder
.Spannable.Factory
SPAN_COMPOSING, SPAN_EXCLUSIVE_EXCLUSIVE, SPAN_EXCLUSIVE_INCLUSIVE, SPAN_INCLUSIVE_EXCLUSIVE, SPAN_INCLUSIVE_INCLUSIVE, SPAN_INTERMEDIATE, SPAN_MARK_MARK, SPAN_MARK_POINT, SPAN_PARAGRAPH, SPAN_POINT_MARK, SPAN_POINT_MARK_MASK, SPAN_POINT_POINT, SPAN_PRIORITY, SPAN_PRIORITY_SHIFT, SPAN_USER, SPAN_USER_SHIFT
Constructor and Description |
---|
SpannableString(CharSequence source) |
Modifier and Type | Method and Description |
---|---|
char |
charAt(int i) |
void |
getChars(int start,
int end,
char[] dest,
int off) |
int |
getSpanEnd(Object what) |
int |
getSpanFlags(Object what) |
<T> T[] |
getSpans(int queryStart,
int queryEnd,
Class<T> kind) |
int |
getSpanStart(Object what) |
int |
length() |
int |
nextSpanTransition(int start,
int limit,
Class kind) |
void |
removeSpan(Object what)
Remove the specified object from the range of text to which it
was attached, if any.
|
void |
setSpan(Object what,
int start,
int end,
int flags)
Attach the specified markup object to the range
start…end
of the text, or move the object to that range if it was already
attached elsewhere. |
CharSequence |
subSequence(int start,
int end)
Returns a
CharSequence from the start index (inclusive)
to the end index (exclusive) of this sequence. |
String |
toString()
Returns a string containing a concise, human-readable description of this
object.
|
static SpannableString |
valueOf(CharSequence source) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSpanEnd, getSpanFlags, getSpans, getSpanStart, nextSpanTransition
charAt, length, toString
public SpannableString(CharSequence source)
public static SpannableString valueOf(CharSequence source)
public void setSpan(Object what, int start, int end, int flags)
Spannable
start…end
of the text, or move the object to that range if it was already
attached elsewhere. See Spanned
for an explanation of
what the flags mean. The object can be one that has meaning only
within your application, or it can be one that the text system will
use to affect text display or behavior. Some noteworthy ones are
the subclasses of CharacterStyle
and
ParagraphStyle
, and
TextWatcher
and
SpanWatcher
.public void removeSpan(Object what)
Spannable
removeSpan
in interface Spannable
public final CharSequence subSequence(int start, int end)
CharSequence
CharSequence
from the start
index (inclusive)
to the end
index (exclusive) of this sequence.subSequence
in interface CharSequence
start
- the start offset of the sub-sequence. It is inclusive, that
is, the index of the first character that is included in the
sub-sequence.end
- the end offset of the sub-sequence. It is exclusive, that is,
the index of the first character after those that are included
in the sub-sequencepublic final int length()
public final char charAt(int i)
public final String toString()
Object
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method
if you intend implementing your own toString
method.
public final void getChars(int start, int end, char[] dest, int off)
public int getSpanStart(Object what)
public int getSpanEnd(Object what)
public int getSpanFlags(Object what)
public <T> T[] getSpans(int queryStart, int queryEnd, Class<T> kind)
public int nextSpanTransition(int start, int limit, Class kind)