Added in API level 1

TextView


open class TextView : View, ViewTreeObserver.OnPreDrawListener
kotlin.Any
   ↳ android.view.View
   ↳ android.widget.TextView

A user interface element that displays text to the user. To provide user-editable text, see EditText.

The following code sample shows a typical use, with an XML layout and code to modify the contents of the text view:

<LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
     <TextView
         android:id="@+id/text_view_id"
         android:layout_height="wrap_content"
         android:layout_width="wrap_content"
         android:text="@string/hello" />
  </LinearLayout>
  

This code sample demonstrates how to modify the contents of the text view defined in the previous XML layout:

public class MainActivity extends Activity {
 
     protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          final TextView helloTextView = (TextView) findViewById(R.id.text_view_id);
          helloTextView.setText(R.string.user_greeting);
      }
  }
  

To customize the appearance of TextView, see Styles and Themes.

XML attributes

See TextView Attributes, View Attributes

Summary

Nested classes

Type of the text buffer that defines the characteristics of the text such as static, styleable, or editable.

abstract

Interface definition for a callback to be invoked when an action is performed on the editor.

open

User interface state that is stored by TextView for implementing View.onSaveInstanceState.

XML attributes
android:allowUndo Whether undo should be allowed for editable text.
android:autoLink Controls whether links such as urls and email addresses are automatically found and converted to clickable links.
android:autoSizeMaxTextSize The maximum text size constraint to be used when auto-sizing text.
android:autoSizeMinTextSize The minimum text size constraint to be used when auto-sizing text.
android:autoSizePresetSizes Resource array of dimensions to be used in conjunction with autoSizeTextType set to uniform .
android:autoSizeStepGranularity Specify the auto-size step size if autoSizeTextType is set to uniform .
android:autoSizeTextType Specify the type of auto-size.
android:autoText If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors.
android:breakStrategy Break strategy (control over paragraph layout).
android:bufferType Determines the minimum type that getText() will return.
android:capitalize If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types.
android:cursorVisible Makes the cursor visible (the default) or invisible.
android:digits If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept.
android:drawableBottom The drawable to be drawn below the text.
android:drawableEnd The drawable to be drawn to the end of the text.
android:drawableLeft The drawable to be drawn to the left of the text.
android:drawablePadding The padding between the drawables and the text.
android:drawableRight The drawable to be drawn to the right of the text.
android:drawableStart The drawable to be drawn to the start of the text.
android:drawableTint Tint to apply to the compound (left, top, etc.) drawables.
android:drawableTintMode Blending mode used to apply the compound (left, top, etc.) drawables tint.
android:drawableTop The drawable to be drawn above the text.
android:editable If set, specifies that this TextView has an input method.
android:editorExtras Reference to an <input-extras> XML resource containing additional data to supply to an input method, which is private to the implementation of the input method.
android:elegantTextHeight Elegant text height, especially for less compacted complex script text.
android:ellipsize If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle.
android:ems Makes the TextView be exactly this many ems wide.
android:enabled Specifies whether the widget is enabled.
android:fallbackLineSpacing Whether to respect the ascent and descent of the fallback fonts that are used in displaying the text.
android:fontFamily Font family (named by string or as a font resource reference) for the text.
android:fontFeatureSettings Font feature settings.
android:fontVariationSettings Font variation settings.
android:freezesText If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position.
android:gravity Specifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view.
android:height Makes the TextView be exactly this tall.
android:hint Hint text to display when the text is empty.
android:hyphenationFrequency Frequency of automatic hyphenation.
android:imeActionId Supply a value for EditorInfo.
android:imeActionLabel Supply a value for EditorInfo.
android:imeOptions Additional features you can enable in an IME associated with an editor to improve the integration with your application.
android:includeFontPadding Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly.
android:inputMethod If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name).
android:inputType The type of data being placed in a text field, used to help an input method decide how to let the user enter text.
android:justificationMode Mode for justification.
android:letterSpacing Text letter-spacing.
android:lineBreakStyle Specifies the line-break strategies for text wrapping.
android:lineBreakWordStyle Specifies the line-break word strategies for text wrapping.
android:lineSpacingExtra Extra spacing between lines of text.
android:lineSpacingMultiplier Extra spacing between lines of text, as a multiplier.
android:lines Makes the TextView be exactly this many lines tall.
android:linksClickable If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found.
android:marqueeRepeatLimit The number of times to repeat the marquee animation.
android:maxEms Makes the TextView be at most this many ems wide.
android:maxHeight Makes the TextView be at most this many pixels tall.
android:maxLength Set an input filter to constrain the text length to the specified number.
android:maxLines Makes the TextView be at most this many lines tall.
android:maxWidth Makes the TextView be at most this many pixels wide.
android:minEms Makes the TextView be at least this many ems wide.
android:minHeight Makes the TextView be at least this many pixels tall.
android:minLines Makes the TextView be at least this many lines tall.
android:minWidth Makes the TextView be at least this many pixels wide.
android:numeric If set, specifies that this TextView has a numeric input method.
android:password Whether the characters of the field are displayed as password dots instead of themselves.
android:phoneNumber If set, specifies that this TextView has a phone number input method.
android:privateImeOptions An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method.
android:scrollHorizontally Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally).
android:selectAllOnFocus If the text is selectable, select it all when the view takes focus.
android:shadowColor Place a blurred shadow of text underneath the text, drawn with the specified color.
android:shadowDx Horizontal offset of the text shadow.
android:shadowDy Vertical offset of the text shadow.
android:shadowRadius Blur radius of the text shadow.
android:singleLine Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key.
android:text Text to display.
android:textAppearance Base text color, typeface, size, and style.
android:textColor Text color.
android:textColorHighlight Color of the text selection highlight.
android:textColorHint Color of the hint text.
android:textColorLink Text color for links.
android:textCursorDrawable Reference to a drawable that will be drawn under the insertion cursor.
android:textFontWeight Weight for the font used in the TextView.
android:textScaleX Sets the horizontal scaling factor for the text.
android:textSelectHandle Reference to a drawable that will be used to display a text selection anchor for positioning the cursor within text.
android:textSelectHandleLeft Reference to a drawable that will be used to display a text selection anchor on the left side of a selection region.
android:textSelectHandleRight Reference to a drawable that will be used to display a text selection anchor on the right side of a selection region.
android:textSize Size of the text.
android:textStyle Style (normal, bold, italic, bold|italic) for the text.
android:typeface Typeface (normal, sans, serif, monospace) for the text.
android:width Makes the TextView be exactly this wide.
Inherited XML attributes
Constants
static Int

The TextView does not auto-size text (default).

static Int

The TextView scales text size both horizontally and vertically to fit within the container.

static Int

A special index used for setFocusedSearchResultIndex(int) and getFocusedSearchResultIndex() inidicating there is no focused search result.

Inherited constants
Public constructors
TextView(context: Context!)

TextView(context: Context!, attrs: AttributeSet?)

TextView(context: Context!, attrs: AttributeSet?, defStyleAttr: Int)

TextView(context: Context!, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int)

Public methods
open Unit

open Unit

Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes.

Unit

Convenience method to append the specified text to the TextView's display buffer, upgrading it to android.widget.TextView.BufferType#EDITABLE if it was not already editable.

open Unit
append(text: CharSequence!, start: Int, end: Int)

Convenience method to append the specified text slice to the TextView's display buffer, upgrading it to android.widget.TextView.BufferType#EDITABLE if it was not already editable.

open Unit

open Unit

open Boolean

Move the point, specified by the offset, into the view if it is needed.

open Boolean
bringPointIntoView(offset: Int, requestRectWithoutFocus: Boolean)

Move the insertion position of the given offset into visible area of the View.

open Unit

open Unit

Use BaseInputConnection.removeComposingSpans() to remove any IME composing state from this text view.

open Unit

open Unit
debug(depth: Int)

open Boolean

Returns true, only while processing a touch gesture, if the initial touch down event caused focus to move to the text view and as a result its selection changed.

open Unit

open Unit

open Boolean

If this TextView contains editable content, extract a portion of it based on the information in request in to outText.

open Unit
findViewsWithText(outViews: ArrayList<View!>!, searched: CharSequence!, flags: Int)

open CharSequence!

Int

Gets the autolink mask of the text.

open Int

open Int

open Int

open IntArray!

open Int

Returns the type of auto-size set for this widget.

open Array<String!>?

open Int

Describes the autofill type of this view, so an android.service.autofill.AutofillService can create the proper AutofillValue when autofilling the view.

open AutofillValue?

Gets the TextView's current text for AutoFill.

open Int

open Int

Gets the current strategy for breaking paragraphs into lines.

open Int

Returns the padding between the compound drawables and the text.

open BlendMode?

Returns the blending mode used to apply the tint to the compound drawables, if specified.

open ColorStateList!

open PorterDuff.Mode!

Returns the blending mode used to apply the tint to the compound drawables, if specified.

open Array<Drawable!>

Returns drawables for the left, top, right, and bottom borders.

open Array<Drawable!>

Returns drawables for the start, top, end, and bottom borders.

open Int

Returns the bottom padding of the view, plus space for the bottom Drawable if any.

open Int

Returns the end padding of the view, plus space for the end Drawable if any.

open Int

Returns the left padding of the view, plus space for the left Drawable if any.

open Int

Returns the right padding of the view, plus space for the right Drawable if any.

open Int

Returns the start padding of the view, plus space for the start Drawable if any.

open Int

Returns the top padding of the view, plus space for the top Drawable if any.

Int

Return the current color selected to paint the hint text.

Int

Return the current color selected for normal text.

open ActionMode.Callback!

Retrieves the value set in setCustomInsertionActionModeCallback.

open ActionMode.Callback!

Retrieves the value set in setCustomSelectionActionModeCallback.

open Editable!

Return the text that TextView is displaying as an Editable object.

open TextUtils.TruncateAt!

Returns where, if anywhere, words that are longer than the view is wide should be ellipsized.

open CharSequence!

Returns the error message that was set to be displayed with #setError, or null if no error was set or if it the error was cleared by the widget after user input.

open Int

Returns the extended bottom padding of the view, including both the bottom Drawable if any and any extra space to keep more than maxLines of text from showing.

open Int

Returns the extended top padding of the view, including both the top Drawable if any and any extra space to keep more than maxLines of text from showing.

open Array<InputFilter!>!

Returns the current list of input filters.

open Int

Returns the distance between the first text baseline and the top of this TextView.

open Unit

open Int

Gets focused search result highlight color.

open Int

Gets the focused search result index.

open String?

Returns the font feature settings.

open String?

Returns the font variation settings.

open Boolean

Return whether this text view is including its entire text contents in frozen icicles.

open Int

Returns the horizontal and vertical alignment of this TextView.

open Int

open Highlights?

Returns highlights

open CharSequence!

Returns the hint that is displayed when the text of the TextView is empty.

ColorStateList!

open Int

Gets the current frequency of automatic hyphenation to be used when determining word breaks.

open Int

Get the IME action ID previous set with setImeActionLabel.

open CharSequence!

Get the IME action label previous set with setImeActionLabel.

open LocaleList?

open Int

Get the type of the Input Method Editor (IME).

open Boolean

Gets whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent.

open Bundle!

Retrieve the input extras currently associated with the text view, which can be viewed as well as modified.

open Int

Get the type of the editable content.

open Int

KeyListener!

Gets the current KeyListener for the TextView.

open Int

Returns the distance between the last text baseline and the bottom of this TextView.

Layout!

Gets the android.text.Layout that is currently being used to display the text.

open Float

Gets the text letter-space value, which determines the spacing between characters.

open Int
getLineBounds(line: Int, bounds: Rect!)

Return the baseline for the specified line (0...getLineCount() - 1) If bounds is not null, return the top, left, right, bottom extents of the specified line in it.

open Int

Gets the current line-break style for text wrapping.

open Int

Gets the current line-break word style for text wrapping.

open Int

Return the number of lines of text, or 0 if the internal Layout has not been built.

open Int

Gets the vertical distance between lines of text, in pixels.

open Float

Gets the line spacing extra space

open Float

Gets the line spacing multiplier

ColorStateList!

Boolean

Returns whether the movement method will automatically be set to LinkMovementMethod if setAutoLinkMask has been set to nonzero and links are detected in #setText.

open Int

Gets the number of times the marquee animation is repeated.

open Int

Returns the maximum width of TextView in terms of ems or -1 if the maximum width was set using setMaxWidth(int) or setWidth(int).

open Int

Returns the maximum height of TextView in terms of pixels or -1 if the maximum height was set using setMaxLines(int) or setLines(int).

open Int

Returns the maximum height of TextView in terms of number of lines or -1 if the maximum height was set using setMaxHeight(int) or setHeight(int).

open Int

Returns the maximum width of TextView in terms of pixels or -1 if the maximum width was set using setMaxEms(int) or setEms(int).

open Int

Returns the minimum width of TextView in terms of ems or -1 if the minimum width was set using setMinWidth(int) or setWidth(int).

open Int

Returns the minimum height of TextView in terms of pixels or -1 if the minimum height was set using setMinLines(int) or setLines(int).

open Int

Returns the minimum height of TextView in terms of number of lines or -1 if the minimum height was set using setMinHeight(int) or setHeight(int).

open Int

Returns the minimum width of TextView in terms of pixels or -1 if the minimum width was set using setMinEms(int) or setEms(int).

open Paint.FontMetrics?

Get the minimum font metrics used for line spacing.

MovementMethod!

Gets the android.text.method.MovementMethod being used for this TextView, which provides positioning, scrolling, and text selection functionality.

open Int

Get the character offset closest to the specified absolute position.

open TextPaint!

Gets the TextPaint used for the text.

open Int

Gets the flags on the Paint being used to display the text.

open String!

Get the private type of the content.

open Int

Gets the search result highlight color.

open IntArray?

Gets the current search result ranges.

open Int

Convenience for Selection.getSelectionEnd.

open Int

Convenience for Selection.getSelectionStart.

open Int

Gets the color of the shadow layer.

open Float

open Float

Gets the vertical offset of the shadow layer.

open Float

Gets the radius of the shadow layer.

open Boolean

Returns true if shifting the drawing x offset for start overhang.

Boolean

Returns whether the soft input method will be made visible when this TextView gets focused.

open CharSequence!

Return the text that TextView is displaying.

open TextClassifier

Returns the TextClassifier used by this TextView.

ColorStateList!

Gets the text colors for the different states (normal, selected, focused) of the TextView.

open Drawable?

Returns the Drawable corresponding to the text cursor.

open TextDirectionHeuristic

Returns resolved TextDirectionHeuristic that will be used for text layout.

open Locale

Get the default primary Locale of the text in this TextView.

open LocaleList

Get the default LocaleList of the text in this TextView.

open PrecomputedText.Params

Gets the parameters for text layout precomputation, for use with PrecomputedText.

open Float

Gets the extent by which text should be stretched horizontally.

open Drawable?

Returns the Drawable corresponding to the selection handle used for positioning the cursor within text.

open Drawable?

Returns the Drawable corresponding to the left handle used for selecting text.

open Drawable?

Returns the Drawable corresponding to the right handle used for selecting text.

open Float

open Int

Gets the text size unit defined by the developer.

open Int

Returns the total bottom padding of the view, including the bottom Drawable if any, the extra space to keep more than maxLines from showing, and the vertical offset for gravity, if any.

open Int

Returns the total end padding of the view, including the end Drawable if any.

open Int

Returns the total left padding of the view, including the left Drawable if any.

open Int

Returns the total right padding of the view, including the right Drawable if any.

open Int

Returns the total start padding of the view, including the start Drawable if any.

open Int

Returns the total top padding of the view, including the top Drawable if any, the extra space to keep more than maxLines from showing, and the vertical offset for gravity, if any.

TransformationMethod!

Gets the current android.text.method.TransformationMethod for the TextView.

open Typeface!

Gets the current Typeface that is used to style the text.

open Array<URLSpan!>!

Returns the list of URLSpans attached to the text (by Linkify or otherwise) if any.

open Boolean

Returns true if using bounding box as a width, false for using advance as a width.

open Boolean

open Boolean

Return true iff there is a selection of nonzero length inside this text view.

open Unit

Invalidates the specified Drawable.

open Boolean

Checks whether the transformation method applied to this TextView is set to ALL CAPS.

open Boolean

open Boolean

open Boolean

Get the value of the TextView's elegant height metrics flag.

open Boolean

Boolean

Returns whether the text is allowed to be wider than the View.

open Boolean

Returns whether this text view is a current input method target.

open Boolean

Returns true if the locale preferred line height is used for the minimum line height.

open Boolean

Returns if the text is constrained to a single horizontally scrolling line ignoring new line characters instead of letting it wrap onto multiple lines.

open Boolean

Return whether or not suggestions are enabled on this TextView.

open Boolean

Returns the state of the textIsSelectable flag (See setTextIsSelectable()).

open Unit

open Int

Returns the length, in characters, of the text managed by this TextView

open Boolean

Move the cursor, if needed, so that it is at an offset that is visible to the user.

open Unit

Called by the framework in response to a request to begin a batch of edit operations through a call to link beginBatchEdit().

open Boolean

open Unit

Called by the framework in response to a text completion from the current input method, provided by it calling InputConnection.commitCompletion().

open Unit

Called by the framework in response to a text auto-correction (such as fixing a typo using a dictionary) from the current input method, provided by it calling InputConnection.commitCorrection().

open InputConnection!

open Unit
onCreateViewTranslationRequest(supportedFormats: IntArray, requestsCollector: Consumer<ViewTranslationRequest!>)

Collects a ViewTranslationRequest which represents the content to be translated in the view.

open Boolean

Handles drag events sent by the system following a call to startDragAndDrop().

open Unit
onEditorAction(actionCode: Int)

Called when an attached input method calls InputConnection.performEditorAction() for this text view.

open Unit

Called by the framework in response to a request to end a batch of edit operations through a call to link endBatchEdit.

open Boolean

open Boolean
onKeyDown(keyCode: Int, event: KeyEvent!)

open Boolean
onKeyMultiple(keyCode: Int, repeatCount: Int, event: KeyEvent!)

open Boolean
onKeyPreIme(keyCode: Int, event: KeyEvent!)

open Boolean
onKeyShortcut(keyCode: Int, event: KeyEvent!)

open Boolean
onKeyUp(keyCode: Int, event: KeyEvent!)

open Boolean

Callback method to be invoked when the view tree is about to be drawn.

open Boolean
onPrivateIMECommand(action: String!, data: Bundle!)

Called by the framework in response to a private command from the current method, provided by it calling InputConnection.performPrivateCommand().

open ContentInfo?

Default TextView implementation for receiving content.

open PointerIcon!
onResolvePointerIcon(event: MotionEvent!, pointerIndex: Int)

open Unit

open Unit
onRtlPropertiesChanged(layoutDirection: Int)

open Parcelable?

open Unit
onScreenStateChanged(screenState: Int)

open Boolean

Called when a context menu option for the text view is selected.

open Boolean

open Boolean

open Unit

open Unit
onWindowFocusChanged(hasWindowFocus: Boolean)

open Boolean

open Unit

Removes the specified TextWatcher from the list of those whose methods are called whenever this TextView's text changes.

open Unit

open Unit
setAllCaps(allCaps: Boolean)

Sets the properties of this field to transform input to ALL CAPS display.

Unit

Sets the autolink mask of the text.

open Unit
setAutoSizeTextTypeUniformWithConfiguration(autoSizeMinTextSize: Int, autoSizeMaxTextSize: Int, autoSizeStepGranularity: Int, unit: Int)

Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds.

open Unit

Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds.

open Unit

Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds by using the default auto-size configuration.

open Unit
setBreakStrategy(breakStrategy: Int)

Sets the break strategy for breaking paragraphs into lines.

open Unit

Sets the size of the padding between the compound drawables and the text.

open Unit

Specifies the blending mode used to apply the tint specified by setCompoundDrawableTintList(android.content.res.ColorStateList) to the compound drawables.

open Unit

Applies a tint to the compound drawables.

open Unit

Specifies the blending mode used to apply the tint specified by setCompoundDrawableTintList(android.content.res.ColorStateList) to the compound drawables.

open Unit
setCompoundDrawables(left: Drawable?, top: Drawable?, right: Drawable?, bottom: Drawable?)

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text.

open Unit
setCompoundDrawablesRelative(start: Drawable?, top: Drawable?, end: Drawable?, bottom: Drawable?)

Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.

open Unit

Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.

open Unit

Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.

open Unit

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text.

open Unit
setCompoundDrawablesWithIntrinsicBounds(left: Int, top: Int, right: Int, bottom: Int)

Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text.

open Unit

Set whether the cursor is visible.

open Unit

If provided, this ActionMode.

open Unit

If provided, this ActionMode.

Unit

Sets the Factory used to create new Editables.

open Unit

Set the TextView's elegant height metrics flag.

open Unit

Causes words in the text that are longer than the view's width to be ellipsized instead of broken in the middle.

open Unit
setEms(ems: Int)

Sets the width of the TextView to be exactly ems wide.

open Unit
setEnabled(enabled: Boolean)

open Unit

Sets the right-hand compound drawable of the TextView to the "error" icon and sets an error message that will be displayed in a popup when the TextView has focus.

open Unit
setError(error: CharSequence!, icon: Drawable!)

Sets the right-hand compound drawable of the TextView to the specified icon and sets an error message that will be displayed in a popup when the TextView has focus.

open Unit

Apply to this text view the given extracted text, as previously returned by extractText(android.view.inputmethod.ExtractedTextRequest,android.view.inputmethod.ExtractedText).

open Unit

Set whether to respect the ascent and descent of the fallback fonts that are used in displaying the text (which is needed to avoid text from consecutive lines running into each other).

open Unit

Sets the list of input filters that will be used if the buffer is Editable.

open Unit
setFirstBaselineToTopHeight(firstBaselineToTopHeight: Int)

Updates the top padding of the TextView so that is the distance between the top of the TextView and first line's baseline.

open Unit

Sets focused search result highlight color.

open Unit

Sets the focused search result index.

open Unit
setFontFeatureSettings(fontFeatureSettings: String?)

Sets font feature settings.

open Boolean
setFontVariationSettings(fontVariationSettings: String?)

Sets TrueType or OpenType font variation settings.

open Unit
setFreezesText(freezesText: Boolean)

Control whether this text view saves its entire text contents when freezing to an icicle, in addition to dynamic state such as cursor position.

open Unit
setGravity(gravity: Int)

Sets the horizontal alignment of the text and the vertical gravity that will be used when there is extra space in the TextView beyond what is required for the text itself.

open Unit
setHeight(pixels: Int)

Sets the height of the TextView to be exactly pixels tall.

open Unit

Sets the color used to display the selection highlight.

open Unit
setHighlights(highlights: Highlights?)

Set Highlights

Unit
setHint(resid: Int)

Sets the text to be displayed when the text of the TextView is empty, from a resource.

Unit

Sets the text to be displayed when the text of the TextView is empty.

Unit

Sets the color of the hint text.

Unit

Sets the color of the hint text for all the states (disabled, focussed, selected...) of this TextView.

open Unit

Sets whether the text should be allowed to be wider than the View is.

open Unit
setHyphenationFrequency(hyphenationFrequency: Int)

Sets the frequency of automatic hyphenation to use when determining word breaks.

open Unit
setImeActionLabel(label: CharSequence!, actionId: Int)

Change the custom IME action associated with the text view, which will be reported to an IME with EditorInfo.actionLabel and EditorInfo.actionId when it has focus.

open Unit

Change "hint" locales associated with the text view, which will be reported to an IME with EditorInfo.hintLocales when it has focus.

open Unit
setImeOptions(imeOptions: Int)

Change the editor type integer associated with the text view, which is reported to an Input Method Editor (IME) with EditorInfo.imeOptions when it has focus.

open Unit

Set whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent.

open Unit
setInputExtras(xmlResId: Int)

Set the extra input data of the text, which is the TextBoxAttribute.extras Bundle that will be filled in when creating an input connection.

open Unit

Set the type of the content with a constant as defined for EditorInfo.inputType.

open Unit
setJustificationMode(justificationMode: Int)

Set justification mode.

open Unit

Sets the key listener to be used with this TextView.

open Unit
setLastBaselineToBottomHeight(lastBaselineToBottomHeight: Int)

Updates the bottom padding of the TextView so that is the distance between the bottom of the TextView and the last line's baseline.

open Unit
setLetterSpacing(letterSpacing: Float)

Sets text letter-spacing in em units.

open Unit
setLineBreakStyle(lineBreakStyle: Int)

Sets the line-break style for text wrapping.

open Unit
setLineBreakWordStyle(lineBreakWordStyle: Int)

Sets the line-break word style for text wrapping.

open Unit
setLineHeight(lineHeight: Int)

Sets an explicit line height for this TextView.

open Unit
setLineHeight(unit: Int, lineHeight: Float)

Sets an explicit line height to a given unit and value for this TextView.

open Unit
setLineSpacing(add: Float, mult: Float)

Sets line spacing for this TextView.

open Unit
setLines(lines: Int)

Sets the height of the TextView to be exactly lines tall.

Unit

Sets the color of links in the text.

Unit

Sets the color of links in the text.

Unit

Sets whether the movement method will automatically be set to LinkMovementMethod if setAutoLinkMask has been set to nonzero and links are detected in #setText.

open Unit

Set true if the locale preferred line height is used for the minimum line height.

open Unit
setMarqueeRepeatLimit(marqueeLimit: Int)

Sets how many times to repeat the marquee animation.

open Unit
setMaxEms(maxEms: Int)

Sets the width of the TextView to be at most maxEms wide.

open Unit
setMaxHeight(maxPixels: Int)

Sets the height of the TextView to be at most maxPixels tall.

open Unit
setMaxLines(maxLines: Int)

Sets the height of the TextView to be at most maxLines tall.

open Unit
setMaxWidth(maxPixels: Int)

Sets the width of the TextView to be at most maxPixels wide.

open Unit
setMinEms(minEms: Int)

Sets the width of the TextView to be at least minEms wide.

open Unit
setMinHeight(minPixels: Int)

Sets the height of the TextView to be at least minPixels tall.

open Unit
setMinLines(minLines: Int)

Sets the height of the TextView to be at least minLines tall.

open Unit
setMinWidth(minPixels: Int)

Sets the width of the TextView to be at least minPixels wide.

open Unit

Set the minimum font metrics used for line spacing.

Unit

Sets the android.text.method.MovementMethod for handling arrow key movement for this TextView.

open Unit

Set a special listener to be called when an action is performed on the text view.

open Unit
setPadding(left: Int, top: Int, right: Int, bottom: Int)

open Unit
setPaddingRelative(start: Int, top: Int, end: Int, bottom: Int)

open Unit

Sets flags on the Paint being used to display the text and reflows the text if they are different from the old flags.

open Unit

Set the private content type of the text, which is the EditorInfo.privateImeOptions field that will be filled in when creating an input connection.

open Unit

Directly change the content type integer of the text view, without modifying any other state.

open Unit

Sets the Scroller used for producing a scrolling animation

open Unit

Sets the search result highlight color.

open Unit

Sets the search result ranges with flatten range representation.

open Unit
setSelectAllOnFocus(selectAllOnFocus: Boolean)

Set the TextView so that when it takes focus, all the text is selected.

open Unit
setSelected(selected: Boolean)

open Unit
setShadowLayer(radius: Float, dx: Float, dy: Float, color: Int)

Gives the text a shadow of the specified blur radius and color, the specified distance from its drawn position.

open Unit
setShiftDrawingOffsetForStartOverhang(shiftDrawingOffsetForStartOverhang: Boolean)

Set true for shifting the drawing x offset for showing overhang at the start position.

Unit

Sets whether the soft input method will be made visible when this TextView gets focused.

open Unit

Sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input.

open Unit
setSingleLine(singleLine: Boolean)

If true, sets the properties of this field (number of lines, horizontally scrolling, transformation method) to be for a single-line input; if false, restores these to the default conditions.

Unit

Sets the Factory used to create new Spannables.

Unit
setText(text: CharArray, start: Int, len: Int)

Sets the TextView to display the specified slice of the specified char array.

Unit
setText(resid: Int)

Sets the text to be displayed using a string resource identifier.

Unit
setText(resid: Int, type: TextView.BufferType!)

Sets the text to be displayed using a string resource identifier and the android.widget.TextView.BufferType.

Unit

Sets the text to be displayed.

open Unit

Sets the text to be displayed and the android.widget.TextView.BufferType.

open Unit
setTextAppearance(context: Context!, resId: Int)

Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.

open Unit

Sets the text appearance from the specified style resource.

open Unit

Sets the TextClassifier for this TextView.

open Unit

Sets the text color.

open Unit
setTextColor(color: Int)

Sets the text color for all the states (normal, selected, focused) to be this color.

open Unit
setTextCursorDrawable(textCursorDrawable: Drawable?)

Sets the Drawable corresponding to the text cursor.

open Unit
setTextCursorDrawable(textCursorDrawable: Int)

Sets the Drawable corresponding to the text cursor.

open Unit

Sets whether the content of this view is selectable by the user.

Unit

Sets the text to be displayed but retains the cursor position.

Unit

Sets the text to be displayed and the android.widget.TextView.BufferType but retains the cursor position.

open Unit

Set the default Locale of the text in this TextView to a one-member LocaleList containing just the given Locale.

open Unit

Set the default LocaleList of the text in this TextView to the given value.

open Unit

Apply the text layout parameter.

open Unit

Sets the horizontal scale factor for text.

open Unit
setTextSelectHandle(textSelectHandle: Drawable)

Sets the Drawable corresponding to the selection handle used for positioning the cursor within text.

open Unit
setTextSelectHandle(textSelectHandle: Int)

Sets the Drawable corresponding to the selection handle used for positioning the cursor within text.

open Unit
setTextSelectHandleLeft(textSelectHandleLeft: Drawable)

Sets the Drawable corresponding to the left handle used for selecting text.

open Unit
setTextSelectHandleLeft(textSelectHandleLeft: Int)

Sets the Drawable corresponding to the left handle used for selecting text.

open Unit
setTextSelectHandleRight(textSelectHandleRight: Drawable)

Sets the Drawable corresponding to the right handle used for selecting text.

open Unit
setTextSelectHandleRight(textSelectHandleRight: Int)

Sets the Drawable corresponding to the right handle used for selecting text.

open Unit

Set the default text size to the given value, interpreted as "scaled pixel" units.

open Unit
setTextSize(unit: Int, size: Float)

Set the default text size to a given unit and value.

Unit

Sets the transformation that is applied to the text that this TextView is displaying.

open Unit

Sets the typeface and style in which the text should be displayed.

open Unit
setTypeface(tf: Typeface?, style: Int)

Sets the typeface and style in which the text should be displayed, and turns on the fake bold and italic bits in the Paint if the Typeface that you provided does not have all the bits in the style that you specified.

open Unit
setUseBoundsForWidth(useBoundsForWidth: Boolean)

Set true for using width of bounding box as a source of automatic line breaking and drawing.

open Unit
setWidth(pixels: Int)

Sets the width of the TextView to be exactly pixels wide.

open Boolean

open Boolean

Protected methods
open Int

open Int

open Int

open Unit

open Int

open Boolean

Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.

open MovementMethod!

Subclasses override this to specify a default movement method.

open Float

open Int

open Float

open Int

open Int

open Boolean

open Unit

open Unit

open Unit

open IntArray!

open Unit
onDraw(canvas: Canvas)

open Unit
onFocusChanged(focused: Boolean, direction: Int, previouslyFocusedRect: Rect?)

open Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

open Unit
onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int)

open Unit
onScrollChanged(horiz: Int, vert: Int, oldHoriz: Int, oldVert: Int)

open Unit
onSelectionChanged(selStart: Int, selEnd: Int)

This method is called when the selection has changed, in case any subclasses would like to know.

open Unit
onTextChanged(text: CharSequence!, start: Int, lengthBefore: Int, lengthAfter: Int)

This method is called when the text is changed, in case any subclasses would like to know.

open Unit
onVisibilityChanged(changedView: View, visibility: Int)

open Boolean
setFrame(l: Int, t: Int, r: Int, b: Int)

open Boolean

If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying.

Inherited functions