AI-generated Key Takeaways
-
The Android text framework provides interfaces and classes for manipulating text, including handling editable text, input filtering, and markup objects.
-
Editable
andSpannable
are key interfaces for text that can be changed and have markup attached, respectively. -
SpannableString
andSpannableStringBuilder
are classes for immutable and mutable text with markup support. -
InputFilters such as
InputFilter.AllCaps
andInputFilter.LengthFilter
control changes made to editable text. -
Utility classes like
Selection
andTextUtils
offer methods for cursor management, string operations, and more.
Interfaces
Editable | This is the interface for text whose content and markup can be changed (as opposed to immutable text like Strings). |
GetChars | Please implement this interface if your CharSequence has a getChars() method like the one in String that is faster than calling charAt() multiple times. |
InputFilter | InputFilters can be attached to Editable s to constrain the
changes that can be made to them. |
InputType | Bit definitions for an integer defining the basic content type of text
held in an Editable object. |
NoCopySpan | This interface should be added to a span object that should not be copied into a new Spenned when performing a slice or copy operation on the original Spanned it was placed in. |
Spannable | This is the interface for text to which markup objects can be attached and detached. |
Spanned | This is the interface for text that has markup objects attached to ranges of it. |
SpanWatcher | When an object of this type is attached to a Spannable, its methods will be called to notify it that other markup objects have been added, changed, or removed. |
TextUtils.StringSplitter | An interface for splitting strings according to rules that are opaque to the user of this interface. |
TextWatcher | When an object of a type is attached to an Editable, its methods will be called when the text is changed. |
Classes
Editable.Factory | Factory used by TextView to create new Editables. |
InputFilter.AllCaps | This filter will capitalize all the lower case letters that are added through edits. |
InputFilter.LengthFilter | This filter will constrain edits not to make the length of the text greater than the specified length. |
NoCopySpan.Concrete | Convenience equivalent for when you would just want a new Object() for a span but want it to be no-copy. |
Selection | Utility class for manipulating cursors and selections in CharSequences. |
Spannable.Factory | Factory used by TextView to create new Spannables. |
SpannableString | This is the class for text whose content is immutable but to which markup objects can be attached and detached. |
SpannableStringBuilder | This is the class for text whose content and markup can both be changed. |
SpannedString | This is the class for text whose content and markup are immutable. |
TextUtils | |
TextUtils.SimpleStringSplitter | A simple string splitter. |