Editable
interface Editable : Appendable, CharSequence, GetChars, Spannable
android.text.Editable |
This is the interface for text whose content and markup can be changed (as opposed to immutable text like Strings). If you make a DynamicLayout
of an Editable, the layout will be reflowed as the text is changed.
Summary
Nested classes | |
---|---|
open |
Factory used by TextView to create new |
Inherited constants | |
---|---|
Public methods | |
---|---|
abstract Editable |
Convenience for append(String.valueOf(text)). |
abstract Editable |
append(text: CharSequence?) Convenience for replace(length(), length(), text, 0, text. |
abstract Editable |
append(text: CharSequence?, start: Int, end: Int) Convenience for replace(length(), length(), text, start, end) |
abstract Unit |
clear() Convenience for replace(0, length(), "", 0, 0). |
abstract Unit |
Removes all spans from the Editable, as if by calling |
abstract Editable! |
Convenience for replace(st, en, "", 0, 0) |
abstract Array<InputFilter!>! |
Returns the array of input filters that are currently applied to changes to this Editable. |
abstract Editable! |
insert(where: Int, text: CharSequence!) Convenience for replace(where, where, text, 0, text.length()); |
abstract Editable! |
insert(where: Int, text: CharSequence!, start: Int, end: Int) Convenience for replace(where, where, text, start, end) |
abstract Editable! |
replace(st: Int, en: Int, text: CharSequence!) Convenience for replace(st, en, text, 0, text.length()) |
abstract Editable! |
Replaces the specified range ( |
abstract Unit |
setFilters(filters: Array<InputFilter!>!) 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. |
Inherited functions | |
---|---|
Public methods
append
abstract fun append(text: Char): Editable
Convenience for append(String.valueOf(text)).
Parameters | |
---|---|
c |
The character to append |
Return | |
---|---|
Editable |
A reference to this Appendable |
Exceptions | |
---|---|
java.io.IOException |
If an I/O error occurs |
append
abstract fun append(text: CharSequence?): Editable
Convenience for replace(length(), length(), text, 0, text.length())
Parameters | |
---|---|
csq |
The character sequence to append. If csq is null , then the four characters "null" are appended to this Appendable. |
Return | |
---|---|
Editable |
A reference to this Appendable |
Exceptions | |
---|---|
java.io.IOException |
If an I/O error occurs |
append
abstract fun append(
text: CharSequence?,
start: Int,
end: Int
): Editable
Convenience for replace(length(), length(), text, start, end)
Parameters | |
---|---|
csq |
The character sequence from which a subsequence will be appended. If csq is null , then characters will be appended as if csq contained the four characters "null" . |
start |
Int: The index of the first character in the subsequence |
end |
Int: The index of the character following the last character in the subsequence |
Return | |
---|---|
Editable |
A reference to this Appendable |
Exceptions | |
---|---|
java.lang.IndexOutOfBoundsException |
If start or end are negative, start is greater than end , or end is greater than csq.length() |
java.io.IOException |
If an I/O error occurs |
clear
abstract fun clear(): Unit
Convenience for replace(0, length(), "", 0, 0). Note that this clears the text, not the spans; use clearSpans
if you need that.
clearSpans
abstract fun clearSpans(): Unit
Removes all spans from the Editable, as if by calling removeSpan
on each of them.
delete
abstract fun delete(
st: Int,
en: Int
): Editable!
Convenience for replace(st, en, "", 0, 0)
getFilters
abstract fun getFilters(): Array<InputFilter!>!
Returns the array of input filters that are currently applied to changes to this Editable.
insert
abstract fun insert(
where: Int,
text: CharSequence!
): Editable!
Convenience for replace(where, where, text, 0, text.length());
insert
abstract fun insert(
where: Int,
text: CharSequence!,
start: Int,
end: Int
): Editable!
Convenience for replace(where, where, text, start, end)
replace
abstract fun replace(
st: Int,
en: Int,
text: CharSequence!
): Editable!
Convenience for replace(st, en, text, 0, text.length())
replace
abstract fun replace(
st: Int,
en: Int,
source: CharSequence!,
start: Int,
end: Int
): Editable!
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
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. If the source
contains a span with Spanned.SPAN_PARAGRAPH
flag, and it does not satisfy the paragraph boundary constraint, it is not retained. As a special case, the cursor position is preserved even when the entire range where it is located is replaced.
Return | |
---|---|
Editable! |
a reference to this object. |
See Also
setFilters
abstract fun setFilters(filters: Array<InputFilter!>!): Unit
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.