android.text
Class SpannableString
java.lang.Object
android.text.SpannableStringInternal
android.text.SpannableString
- All Implemented Interfaces:
- GetChars, Spannable, Spanned, CharSequence
public class SpannableString
- extends SpannableStringInternal
- implements CharSequence, GetChars, Spannable
This is the class for text whose content is immutable but to which
markup objects can be attached and detached.
For mutable text, see SpannableStringBuilder.
| Fields inherited from interface android.text.Spanned |
SPAN_EXCLUSIVE_EXCLUSIVE, SPAN_EXCLUSIVE_INCLUSIVE, SPAN_INCLUSIVE_EXCLUSIVE, SPAN_INCLUSIVE_INCLUSIVE, SPAN_MARK_MARK, SPAN_MARK_POINT, SPAN_PARAGRAPH, SPAN_POINT_MARK, SPAN_POINT_POINT, SPAN_PRIORITY, SPAN_PRIORITY_SHIFT, SPAN_USER, SPAN_USER_SHIFT |
|
Method Summary |
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. |
static SpannableString |
valueOf(CharSequence source)
|
SpannableString
public SpannableString(CharSequence source)
valueOf
public static SpannableString valueOf(CharSequence source)
setSpan
public void setSpan(Object what,
int start,
int end,
int flags)
- Description copied from interface:
Spannable
- 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. 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.
- Specified by:
setSpan in interface Spannable- Overrides:
setSpan in class SpannableStringInternal
removeSpan
public void removeSpan(Object what)
- Description copied from interface:
Spannable
- Remove the specified object from the range of text to which it
was attached, if any. It is OK to remove an object that was never
attached in the first place.
- Specified by:
removeSpan in interface Spannable- Overrides:
removeSpan in class SpannableStringInternal
subSequence
public final CharSequence subSequence(int start,
int end)
- Description copied from interface:
CharSequence
- Returns a CharSequence from the
start index (inclusive) to
the end index (exclusive) of this sequence.
- Specified by:
subSequence in interface CharSequence
- Parameters:
start - The starting offset of the sub-sequence, that is, the
index of the first character that goes into the sub-sequenceend - The ending offset of the sub-sequence, that is, the
index of the first character after those that go into the
sub-sequence
- Returns:
- The requested sub-sequence
Please submit a feedback, bug or feature