java.lang.Object | |
↳ | android.text.SpannableStringBuilder |
This is the class for text whose content and markup can both be changed.
[Expand]
Inherited Constants
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.text.Spanned
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Create a new SpannableStringBuilder with empty contents
|
||||||||||
|
Create a new SpannableStringBuilder containing a copy of the
specified text, including its spans if any.
|
||||||||||
|
Create a new SpannableStringBuilder containing a copy of the
specified slice of the specified text, including its spans if any.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Convenience for append(String.valueOf(text)).
|
||||||||||
|
Convenience for replace(length(), length(), text, start, end)
|
||||||||||
|
Convenience for replace(length(), length(), text, 0, text.length())
|
||||||||||
|
Return the char at the specified offset within the buffer.
|
||||||||||
|
Convenience for replace(0, length(), "", 0, 0)
|
||||||||||
|
Removes all spans from the Editable, as if by calling
removeSpan(Object)
on each of them.
|
||||||||||
|
Convenience for replace(st, en, "", 0, 0)
|
||||||||||
|
Just like
drawText(char[], int, int, float, float, Paint)
.
|
||||||||||
|
Compares this instance with the specified object and indicates if they
are equal.
|
||||||||||
|
Copy the specified range of chars from this buffer into the
specified array, beginning at the specified offset.
|
||||||||||
|
Returns the array of input filters that are currently applied
to changes to this Editable.
|
||||||||||
|
Return the buffer offset of the end of the specified
markup object, or -1 if it is not attached to this buffer.
|
||||||||||
|
Return the flags of the end of the specified
markup object, or 0 if it is not attached to this buffer.
|
||||||||||
|
Return the buffer offset of the beginning of the specified
markup object, or -1 if it is not attached to this buffer.
|
||||||||||
|
Return an array of the spans of the specified type that overlap
the specified range of the buffer.
|
||||||||||
|
This method was deprecated
in API level 12.
This is an internal method, refrain from using it in your code
|
||||||||||
|
Just like
getTextWidths(char[], int, int, float[])
.
|
||||||||||
|
Returns an integer hash code for this object.
|
||||||||||
|
Convenience for replace(where, where, text, start, end)
|
||||||||||
|
Convenience for replace(where, where, text, 0, text.length());
|
||||||||||
|
Return the number of chars in the buffer.
|
||||||||||
|
Just like
measureText(char[], int, int)
.
|
||||||||||
|
Return the next offset after
start
but less than or
equal to
limit
where a span of the specified type
begins or ends.
|
||||||||||
|
Remove the specified markup object from the buffer.
|
||||||||||
|
Convenience for replace(st, en, text, 0, text.length())
|
||||||||||
|
Replaces the specified range (
st…en
) of text in this
Editable with a copy of the slice
start…end
from
source
.
|
||||||||||
|
Sets the series of filters that will be called in succession
whenever the text of this Editable is changed, each of which has
the opportunity to limit or transform the text that is being inserted.
|
||||||||||
|
Mark the specified range of text with the specified object.
|
||||||||||
|
Return a new CharSequence containing a copy of the specified
range of this buffer, including the overlapping spans.
|
||||||||||
|
Return a String containing a copy of the chars in this buffer.
|
||||||||||
|
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
|||||||||||
From interface
android.text.Editable
|
|||||||||||
From interface
android.text.GetChars
|
|||||||||||
From interface
android.text.Spannable
|
|||||||||||
From interface
android.text.Spanned
|
|||||||||||
From interface
java.lang.Appendable
|
|||||||||||
From interface
java.lang.CharSequence
|
Create a new SpannableStringBuilder with empty contents
Create a new SpannableStringBuilder containing a copy of the specified text, including its spans if any.
Create a new SpannableStringBuilder containing a copy of the specified slice of the specified text, including its spans if any.
Convenience for append(String.valueOf(text)).
text | the character to append. |
---|
Appendable
.
Convenience for replace(length(), length(), text, start, end)
text | the character sequence to append. |
---|---|
start |
the first index of the subsequence of
csq
that is
appended.
|
end |
the last index of the subsequence of
csq
that is
appended.
|
Appendable
.
Convenience for replace(length(), length(), text, 0, text.length())
text | the character sequence to append. |
---|
Appendable
.
Return the char at the specified offset within the buffer.
Removes all spans from the Editable, as if by calling
removeSpan(Object)
on each of them.
Convenience for replace(st, en, "", 0, 0)
Just like
drawText(char[], int, int, float, float, Paint)
.
Compares this instance with the specified object and indicates if they
are equal. In order to be equal,
o
must represent the same object
as this instance using a class-specific comparison. The general contract
is that this comparison should be reflexive, symmetric, and transitive.
Also, no object reference other than null is equal to null.
The default implementation returns
true
only if
this ==
o
. See
Writing a correct
equals
method
if you intend implementing your own
equals
method.
The general contract for the
equals
and
hashCode()
methods is that if
equals
returns
true
for
any two objects, then
hashCode()
must return the same value for
these objects. This means that subclasses of
Object
usually
override either both methods or neither of them.
o | the object to compare this instance with. |
---|
true
if the specified object is equal to this
Object
;
false
otherwise.
Copy the specified range of chars from this buffer into the specified array, beginning at the specified offset.
Returns the array of input filters that are currently applied to changes to this Editable.
Return the buffer offset of the end of the specified markup object, or -1 if it is not attached to this buffer.
Return the flags of the end of the specified markup object, or 0 if it is not attached to this buffer.
Return the buffer offset of the beginning of the specified markup object, or -1 if it is not attached to this buffer.
Return an array of the spans of the specified type that overlap the specified range of the buffer. The kind may be Object.class to get a list of all the spans regardless of type.
This method was deprecated
in API level 12.
This is an internal method, refrain from using it in your code
Returns the next cursor position in the run. This avoids placing the cursor between surrogates, between characters that form conjuncts, between base characters and combining marks, or within a reordering cluster.
The context is the shaping context for cursor movement, generally the bounds of the metric
span enclosing the cursor in the direction of movement.
contextStart
,
contextEnd
and
offset
are relative to
the start of the string.
If cursorOpt is CURSOR_AT and the offset is not a valid cursor position, this returns -1. Otherwise this will never return a value before contextStart or after contextEnd.
contextStart | the start index of the context |
---|---|
contextEnd | the (non-inclusive) end index of the context |
flags | either DIRECTION_RTL or DIRECTION_LTR |
offset | the cursor position to move from |
cursorOpt | how to move the cursor, one of CURSOR_AFTER, CURSOR_AT_OR_AFTER, CURSOR_BEFORE, CURSOR_AT_OR_BEFORE, or CURSOR_AT |
p | the Paint object that is requesting this information |
Just like
getTextWidths(char[], int, int, float[])
.
Returns an integer hash code for this object. By contract, any two
objects for which
equals(Object)
returns
true
must return
the same hash code value. This means that subclasses of
Object
usually override both methods or neither method.
Note that hash values must not change over time unless information used in equals comparisons also changes.
See
Writing a correct
hashCode
method
if you intend implementing your own
hashCode
method.
Convenience for replace(where, where, text, start, end)
Convenience for replace(where, where, text, 0, text.length());
Return the number of chars in the buffer.
Just like
measureText(char[], int, int)
.
Return the next offset after
start
but less than or
equal to
limit
where a span of the specified type
begins or ends.
Remove the specified markup object from the buffer.
Convenience for replace(st, en, text, 0, text.length())
Replaces the specified range (
st…en
) of text in this
Editable with a copy of the slice
start…end
from
source
. The destination slice may be empty, in which case
the operation is an insertion, or the source slice may be empty,
in which case the operation is a deletion.
Before the change is committed, each filter that was set with
setFilters(InputFilter[])
is given the opportunity to modify the
source
text.
If
source
is Spanned, the spans from it are preserved into the Editable.
Existing spans within the Editable that entirely cover the replaced
range are retained, but any that were strictly within the range
that was replaced are removed. As a special case, the cursor
position is preserved even when the entire range where it is
located is replaced.
Sets the series of filters that will be called in succession whenever the text of this Editable is changed, each of which has the opportunity to limit or transform the text that is being inserted.
Mark the specified range of text with the specified object. The flags determine how the span will behave when text is inserted at the start or end of the span's range.
Return a new CharSequence containing a copy of the specified range of this buffer, including the overlapping spans.
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-sequence |
Return a String containing a copy of the chars in this buffer.