android.text
Provides classes used to render or track text and text spans on the screen.
You can use these classes to design your own widgets that manage text, to handle arbitrary text spans for changes, or to handle drawing yourself for an existing widget.
The Span… interfaces and classes are used to create or manage spans of text in a View item. You can use these to style the text or background, or to listen for changes. If creating your own widget, extend DynamicLayout, to manages the actual wrapping and drawing of your text.
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. |
Html.ImageGetter | Retrieves images for HTML <img> tags. |
Html.TagHandler | Is notified when HTML tags are encountered that the parser does not know how to interpret. |
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.
|
Layout.TextInclusionStrategy | Strategy for determining whether a text segment is inside a rectangle area. |
NoCopySpan | This interface should be added to a span object that should not be copied into a new Spanned when performing a slice or copy operation on the original Spanned it was placed in. |
ParcelableSpan | A special kind of Parcelable for objects that will serve as text spans. |
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. |
TextDirectionHeuristic | Interface for objects that use a heuristic for guessing at the paragraph direction by examining text. |
TextShaper.GlyphsConsumer | A consumer interface for accepting text shape result. |
TextUtils.EllipsizeCallback | |
TextUtils.StringSplitter | An interface for splitting strings according to rules that are opaque to the user of this interface. |
TextWatcher | When an object of this type is attached to an Editable, its methods will be called when the text is changed. |
Classes
AlteredCharSequence | This class was deprecated in API level 30. The functionality this class offers is easily implemented outside the framework. |
AndroidCharacter |
This class was deprecated
in API level 26.
Use various methods from UCharacter , instead.
|
Annotation | Annotations are simple key-value pairs that are preserved across TextView save/restore cycles and can be used to keep application-specific data that needs to be maintained for regions of text. |
AutoText | This class accesses a dictionary of corrections to frequent misspellings. |
BidiFormatter | Utility class for formatting text for display in a potentially opposite-directionality context without garbling. |
BidiFormatter.Builder | A class for building a BidiFormatter with non-default options. |
BoringLayout | A BoringLayout is a very simple Layout implementation for text that fits on a single line and is all left-to-right characters. |
BoringLayout.Metrics | |
ClipboardManager |
This class was deprecated
in API level 11.
Old text-only interface to the clipboard. See
ClipboardManager for the modern API.
|
DynamicLayout | DynamicLayout is a text layout that updates itself as the text is edited. |
DynamicLayout.Builder | Builder for dynamic layouts. |
Editable.Factory |
Factory used by TextView to create new Editables .
|
EmojiConsistency | The set of emoji that should be drawn by the system with the default font for device consistency. |
GraphemeClusterSegmentFinder |
Implementation of SegmentFinder using grapheme clusters as the text segment.
|
Highlights | A class that represents of the highlight of the text. |
Highlights.Builder | A builder for the Highlights. |
Html | This class processes HTML strings into displayable styled text. |
InputFilter.AllCaps | This filter will capitalize all the lowercase and titlecase 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. |
Layout | A base class that manages text layout in visual elements on the screen. |
Layout.Builder | A builder class for Layout object. |
Layout.Directions | Stores information about bidirectional (left-to-right or right-to-left) text within the layout of a line. |
LoginFilter | This class was deprecated in API level 30. Password requirements should not be hardcoded in clients. This class also does not handle non-BMP characters. |
LoginFilter.PasswordFilterGMail | This class was deprecated in API level 30. Do not handle a user's Google password. Refer to Google Help for password restriction information. |
LoginFilter.UsernameFilterGeneric | This filter rejects characters in the user name that are not compatible with Google login. |
LoginFilter.UsernameFilterGMail | This class was deprecated in API level 30. Do not encode assumptions about Google account names into client applications. |
NoCopySpan.Concrete | Convenience equivalent for when you would just want a new Object() for a span but want it to be no-copy. |
PrecomputedText | A text which has the character metrics data. |
PrecomputedText.Params |
The information required for building PrecomputedText .
|
PrecomputedText.Params.Builder |
A builder for creating Params .
|
SegmentFinder | Finds text segment boundaries within text. |
SegmentFinder.PrescribedSegmentFinder |
The default SegmentFinder implementation based on given segment ranges.
|
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. |
StaticLayout | StaticLayout is a Layout for text that will not be edited after it is laid out. |
StaticLayout.Builder | Builder for static layouts. |
TextDirectionHeuristics |
Some objects that implement TextDirectionHeuristic .
|
TextPaint | TextPaint is an extension of Paint that leaves room for some extra data used during text measuring and drawing. |
TextShaper | Provides text shaping for multi-styled text. |
TextUtils | |
TextUtils.SimpleStringSplitter | A simple string splitter. |
WordSegmentFinder |
Implementation of SegmentFinder using words as the text segment.
|
Enums
Layout.Alignment | |
TextUtils.TruncateAt |
Interfaces
Classes
- AlteredCharSequence
- AndroidCharacter
- Annotation
- AutoText
- BidiFormatter
- BidiFormatter.Builder
- BoringLayout
- BoringLayout.Metrics
- ClipboardManager
- DynamicLayout
- DynamicLayout.Builder
- Editable.Factory
- EmojiConsistency
- GraphemeClusterSegmentFinder
- Highlights
- Highlights.Builder
- Html
- InputFilter.AllCaps
- InputFilter.LengthFilter
- Layout
- Layout.Builder
- Layout.Directions
- LoginFilter
- LoginFilter.PasswordFilterGMail
- LoginFilter.UsernameFilterGeneric
- LoginFilter.UsernameFilterGMail
- NoCopySpan.Concrete
- PrecomputedText
- PrecomputedText.Params
- PrecomputedText.Params.Builder
- SegmentFinder
- SegmentFinder.PrescribedSegmentFinder
- Selection
- Spannable.Factory
- SpannableString
- SpannableStringBuilder
- SpannedString
- StaticLayout
- StaticLayout.Builder
- TextDirectionHeuristics
- TextPaint
- TextShaper
- TextUtils
- TextUtils.SimpleStringSplitter
- WordSegmentFinder
Enums