Show
Known indirect subclasses
A user interface element that displays text to the user. To provide user-editable text, see 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 Summary
XML attributesandroid:allowUndoWhether undo should be allowed for editable text. Defaults to true. May be a boolean value, such as " android:autoLinkControls whether links such as urls and email addresses are automatically found and converted to clickable links. The default value is "none", disabling this feature. Must be one or more (separated by '|') of the following constant values.
Related methods:
android:autoSizeMaxTextSizeThe maximum text size constraint to be used when auto-sizing text. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:autoSizeMinTextSizeThe minimum text size constraint to be used when auto-sizing text. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:autoSizePresetSizesResource array of dimensions to be used in conjunction with May be a reference to another resource, in the form " May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; May be an integer value, such as " May be a boolean value, such as " May be a color value, in the form of " May be a floating point value, such as " May be a dimension value, which is a floating point number appended with a unit such as " May be a fractional value, which is a floating point number appended with either % or %p, such as " Related methods:
android:autoSizeStepGranularitySpecify the auto-size step size if May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:autoSizeTextTypeSpecify the type of auto-size. Note that this feature is not supported by EditText, works only for TextView. Must be one of the following constant values.
Related methods:
android:autoTextIf set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors. The default is "false". May be a boolean value, such as " Related methods:
android:breakStrategyBreak strategy (control over paragraph layout). Must be one of the following constant values.
Related methods:
android:bufferTypeDetermines the minimum type that getText() will return. The default is "normal". Note that EditText and LogTextBox always return Editable, even if you specify something less powerful here. Must be one of the following constant values.
Related methods:
android:capitalizeIf set, specifies that this TextView has a textual input method and should automatically capitalize what the user types. The default is "none". Must be one of the following constant values.
Related methods:
android:cursorVisibleMakes the cursor visible (the default) or invisible. May be a boolean value, such as " Related methods:
android:digitsIf set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept. If this is set, numeric is implied to be true. The default is false. May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:drawableBottomThe drawable to be drawn below the text. May be a
reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:drawableEndThe drawable to be drawn to the end of the text. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:drawableLeftThe drawable to be drawn to the left of the text. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:drawablePaddingThe padding between the drawables and the text. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:drawableRightThe drawable to be drawn to the right of the text. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:drawableStartThe drawable to be drawn to the start of the text. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:drawableTintTint to apply to the compound (left, top, etc.) drawables. May be a color value, in the form of " Related methods:
android:drawableTintModeBlending mode used to apply the compound (left, top, etc.) drawables tint. Must be one of the following constant values.
Related methods:
android:drawableTopThe drawable to be drawn above the text. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:editableIf set, specifies that this TextView has an input method. It will be a textual one unless it has otherwise been specified. For TextView, this is false by default. For EditText, it is true by default. May be a boolean value, such as " android:editorExtrasReference to an May be a reference to another resource, in the form " Related methods:
android:elegantTextHeightElegant text height, especially for less compacted complex script text. May be a boolean value, such as " Related methods:
android:ellipsizeIf set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle. You will often also want to set scrollHorizontally or singleLine as well so that the text as a whole is also constrained to a single line instead of still allowed to be broken onto multiple lines. Must be one of the following constant values.
Related methods:
android:emsMakes the TextView be exactly this many ems wide. May be an integer value, such as " Related methods:
android:enabledSpecifies whether the widget is enabled. The interpretation of the enabled state varies by subclass. For example, a non-enabled EditText prevents the user from editing the contained text, and a non-enabled Button prevents the user from tapping the button. The appearance of enabled and non-enabled widgets may differ, if the drawables referenced from evaluating state_enabled differ. May be a boolean value, such as " android:fallbackLineSpacingWhether to respect the ascent and descent of the fallback fonts that are used in displaying the text. When true, fallback fonts that end up getting used can increase the ascent and descent of the lines that they are used on. May be a boolean value, such as " Related methods:
android:firstBaselineToTopHeightDistance from the top of the TextView to the first text baseline. If set, this overrides the value set for paddingTop. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:fontFamilyFont family (named by string or as a font resource reference) for the text. May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:fontFeatureSettingsFont feature settings. May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:fontVariationSettingsFont variation settings. May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:freezesTextIf 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. By default this is disabled; it can be useful when the contents of a text view is not stored in a persistent place such as a content provider. For May be a boolean value, such as " Related methods:
android:gravitySpecifies how to align the text by the view's x- and/or y-axis when the text is smaller than the view. Must be one or more (separated by '|') of the following constant values.
Related methods:
android:heightMakes the TextView be exactly this tall. You could get the same effect by specifying this number in the layout parameters. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:hintHint text to display when the text is empty. May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:hyphenationFrequencyFrequency of automatic hyphenation. Must be one of the following constant values.
Related methods:
android:imeActionIdSupply a value for May be an integer value, such as " Related methods:
android:imeActionLabelSupply
a value for May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:imeOptionsAdditional features you can enable in an IME associated with an editor to improve the integration with your application. The constants here correspond to
those defined by Must be one or more (separated by '|') of the following constant values.
Related methods:
android:includeFontPaddingLeave enough room for ascenders and descenders instead of using the font ascent and descent strictly. (Normally true). May be a boolean value, such as " Related methods:
android:inputMethodIf set, specifies that this TextView should use the specified input method (specified by fully-qualified class name). May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:inputTypeThe type of data being placed in a text field, used to help an
input method decide how to let the user enter text. The constants here correspond to those defined by Must be one or more (separated by '|') of the following constant values.
Related methods:
android:justificationModeMode for justification. Must be one of the following constant values.
android:lastBaselineToBottomHeightDistance from the bottom of the TextView to the last text baseline. If set, this overrides the value set for paddingBottom. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:letterSpacingText letter-spacing. May be a floating point value, such as " Related methods:
android:lineBreakStyleSpecifies the line-break strategies for text wrapping. Must be one of the following constant values.
android:lineBreakWordStyleSpecifies the line-break word strategies for text wrapping. Must be one of the following constant values.
android:lineHeightExplicit height between lines of text. If set, this will override the values set for lineSpacingExtra and lineSpacingMultiplier. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:lineSpacingExtraExtra spacing between lines of text. The value will not be applied for the last line of text. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:lineSpacingMultiplierExtra spacing between lines of text, as a multiplier. The value will not be applied for the last line of text. May be a floating point value, such as " Related methods:
android:linesMakes the TextView be exactly this many lines tall. May be an integer value, such as " Related methods:
android:linksClickableIf set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found. May be a boolean value, such as " Related methods:
android:marqueeRepeatLimitThe number of times to repeat the marquee animation. Only applied if the TextView has marquee enabled. May be an integer value, such as " Must be one of the following constant values.
Related methods:
android:maxEmsMakes the TextView be at most this many ems wide. May be an integer value, such as " Related methods:
android:maxHeightMakes the TextView be at most this many pixels tall. May be
a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:maxLengthSet an input filter to constrain the text length to the specified number. May be an integer value, such
as " Related methods:
android:maxLinesMakes the TextView be at most this many lines tall. When used on an editable text, the May be an integer value, such as " Related methods:
android:maxWidthMakes the TextView be at most this many pixels wide. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:minEmsMakes the TextView be at least this many ems wide. May be an integer value, such as " Related methods:
android:minHeightMakes the TextView be at least this many pixels tall. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:minLinesMakes the TextView be at least this many lines tall. When used on an editable text, the May be an integer value, such as " Related methods:
android:minWidthMakes the TextView be at least this many pixels wide. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:numericIf set, specifies that this TextView has a numeric input method. The default is false. Must be one or more (separated by '|') of the following constant values.
Related methods:
android:passwordWhether the characters of the field are displayed as password dots instead of themselves. May be a boolean value, such as " Related methods:
android:phoneNumberIf set, specifies that this TextView has a phone number input method. The default is false. May be a boolean value, such as " Related methods:
android:privateImeOptionsAn 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. This simply fills in
the May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:scrollHorizontallyWhether the text is allowed to be wider than the view (and therefore can be scrolled horizontally). May be a boolean value, such as " Related methods:
android:selectAllOnFocusIf the text is selectable, select it all when the view takes focus. May be a boolean value, such as " Related methods:
android:shadowColorPlace
a blurred shadow of text underneath the text, drawn with the specified color. The text shadow produced does not interact with properties on View that are responsible for real time shadows, May be a color value, in the form of " Related methods:
android:shadowDxHorizontal offset of the text shadow. May
be a floating point value, such as " Related methods:
android:shadowDyVertical offset of the text shadow. May be a floating point value, such as " Related methods:
android:shadowRadiusBlur radius of the text shadow. May be a floating
point value, such as " Related methods:
android:singleLineConstrains 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. The default value is false (multi-line wrapped text mode) for non-editable text, but if you specify any value for inputType, the default is true (single-line input field mode). May be a boolean value, such as " Related methods:
android:textText to display. May be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character; Related methods:
android:textAllCapsPresent the text in ALL CAPS. This may use a small-caps form when available. May be a boolean value, such as " Related methods:
android:textAppearanceBase text color, typeface, size, and style. May be a reference to another resource, in the form " Related methods:
android:textColorText color. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:textColorHighlightColor of the text selection highlight. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:textColorHintColor of the hint text. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:textColorLinkText color for links. May be a reference to another resource, in the form " May be a color value, in the form of " Related methods:
android:textCursorDrawableReference to a drawable that will be drawn under the insertion cursor. May be a reference to another resource, in the form " Related methods:
android:textFontWeightWeight for the font used in the TextView. May be an integer value, such as " android:textIsSelectableIndicates that the content of a non-editable text can be selected. May be a boolean value, such as " Related methods:
android:textScaleXSets the horizontal scaling factor for the text. May be a floating point value, such as " Related methods:
android:textSelectHandleReference to a drawable that will be used to display a text selection anchor for positioning the cursor within text. May
be a reference to another resource, in the form " Related methods:
android:textSelectHandleLeftReference to a drawable that will be used to display a text selection anchor on the left side of a selection region. May be a reference to another resource, in the form " Related methods:
android:textSelectHandleRightReference to a drawable that will be used to display a text selection anchor on the right side of a selection region. May be a reference to another resource, in the form " Related methods:
android:textSizeSize of the text. Recommended dimension type for text is "sp" for scaled-pixels (example: 15sp). May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
android:textStyleStyle (normal, bold, italic, bold|italic) for the text. Must be one or more (separated by '|') of the following constant values.
Related methods:
android:typefaceTypeface (normal, sans, serif, monospace) for the text. Must be one of the following constant values.
Related methods:
android:widthMakes the TextView be exactly this wide. You could get the same effect by specifying this number in the layout parameters. May be a dimension value, which is a floating point number appended with a unit such as " Related methods:
ConstantsAUTO_SIZE_TEXT_TYPE_NONEAdded in API level 26 public static final int AUTO_SIZE_TEXT_TYPE_NONE The TextView does not auto-size text (default). Constant Value: 0 (0x00000000) AUTO_SIZE_TEXT_TYPE_UNIFORMAdded in API level 26 public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM The TextView scales text size both horizontally and vertically to fit within the container. Constant Value: 1 (0x00000001) Public constructorsTextViewAdded in API level 1 public TextView (Context context)
TextViewAdded in API level 1 public TextView (Context context, AttributeSet attrs)
TextViewAdded in API level 1 public TextView (Context context, AttributeSet attrs, int defStyleAttr)
TextViewAdded in API level 21 public TextView (Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)
Public methodsaddExtraDataToAccessibilityNodeInfoAdded in API level 26 public void addExtraDataToAccessibilityNodeInfo (AccessibilityNodeInfo info, String extraDataKey, Bundle arguments) Adds extra data to an This method only needs overloading if the node is marked as having extra data available.
addTextChangedListenerAdded in API level 1 public void addTextChangedListener (TextWatcher watcher) Adds a TextWatcher to the list of those whose methods are called whenever this TextView's text changes. In 1.0, the
appendAdded in API level 1 public final void append (CharSequence text) Convenience method to append the specified text to the TextView's display buffer, upgrading it to
appendAdded in API level 1 public void append (CharSequence text, int start, int end) Convenience method to append the specified text slice to the TextView's display buffer, upgrading it to
See also:
autofillAdded in API level 26 public void autofill (AutofillValue value) Automatically fills the content of this view with the Views support the Autofill Framework mainly by:
This method does nothing by default, but when overridden it typically:
For example, a text-field view could implement the method this way: @Override public void autofill(AutofillValue value) { if (!value.isText() || !this.isEditable()) { return; } CharSequence text = value.getTextValue(); if (text != null) { this.setText(text); } } If the value is updated asynchronously, the next call to Note: After this method is called, the value returned by
beginBatchEditAdded in API level 3 public void beginBatchEdit () bringPointIntoViewAdded in API level 3 public boolean bringPointIntoView (int offset) Move the point, specified by the offset, into the view if it is needed. This has to be called after layout. Returns true if anything changed.
cancelLongPressAdded in API level 1 public void cancelLongPress () Cancels a pending long press. Your subclass can use this if you want the context menu to come up if the user presses and holds at the same place, but you don't want it to come up if they press and then move around enough to cause scrolling. clearComposingTextAdded in API level 3 public void clearComposingText () Use computeScrollAdded in API level 1 public void computeScroll () Called by a parent to request that a child update its values for mScrollX and mScrollY if necessary. This will typically be done if the child is animating a scroll using a debugAdded in API level 1 public void debug (int depth)
didTouchFocusSelectAdded in API level 3 public boolean didTouchFocusSelect () 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. Only valid while processing the touch gesture of interest, in an editable text view.
drawableHotspotChangedAdded in API level 21 public void drawableHotspotChanged (float x, float y) This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view. Dispatching to child views is
handled by Be sure to call through to the superclass when overriding this function.
endBatchEditAdded in API level 3 public void endBatchEdit () extractTextAdded in API level 3 public boolean extractText (ExtractedTextRequest request, ExtractedText outText) If this TextView contains editable content, extract a portion of it based on the information in request in to outText.
findViewsWithTextAdded in API level 14 public void findViewsWithText (ArrayList<View> outViews, CharSequence searched, int flags) Finds the Views that contain given text. The containment is case insensitive. The search is performed by either the text that the View
renders or the content description that describes the view for accessibility purposes and the view does not render or both. Clients can specify how the search is to be performed via passing the
getAccessibilityClassNameAdded in API level 23 public CharSequence getAccessibilityClassName () Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely
new class of view when used by accessibility, unrelated to the class it is deriving from. This is used to fill in
getAutoLinkMaskAdded in API level 1 public final int getAutoLinkMask () Gets the autolink mask of the text. See Related XML Attributes:
getAutoSizeMaxTextSizeAdded in API level 26 public int getAutoSizeMaxTextSize () Related XML Attributes:
See also:
getAutoSizeMinTextSizeAdded in API level 26 public int getAutoSizeMinTextSize () Related XML Attributes:
See also:
getAutoSizeStepGranularityAdded in API level 26 public int getAutoSizeStepGranularity () Related XML Attributes:
See also:
getAutoSizeTextAvailableSizesAdded in API level 26 public int[] getAutoSizeTextAvailableSizes ()
See also:
getAutoSizeTextTypeAdded in API level 26 public int getAutoSizeTextType () Returns the type of auto-size set for this widget. Related XML Attributes:
See also:
getAutofillHintsAdded in API level 26 public String[] getAutofillHints () Gets the hints that help an See
getAutofillTypeAdded in API level 26 public int getAutofillType () Describes the autofill type of this view, so an By default returns
getAutofillValueAdded in API level 26 public AutofillValue getAutofillValue () Gets the
See also:
getBaselineAdded in API level 1 public int getBaseline () Return the offset of the widget's text baseline from the widget's top boundary. If this widget does not support baseline alignment, this method returns -1.
getBreakStrategyAdded in API level 23 public int getBreakStrategy () Gets the current strategy for breaking paragraphs into lines. Related XML Attributes:
See also:
getCompoundDrawablePaddingAdded in API level 1 public int getCompoundDrawablePadding () Returns the padding between the compound drawables and the text. Related XML Attributes:
getCompoundDrawableTintBlendModeAdded in API level 29 public BlendMode getCompoundDrawableTintBlendMode () Returns the blending mode used to apply the tint to the compound drawables, if specified. Related XML Attributes:
See also:
getCompoundDrawableTintListAdded in API level 23 public ColorStateList getCompoundDrawableTintList () Related XML Attributes:
See also:
getCompoundDrawableTintModeAdded in API level 23 public PorterDuff.Mode getCompoundDrawableTintMode () Returns the blending mode used to apply the tint to the compound drawables, if specified. Related XML Attributes:
See also:
getCompoundDrawablesAdded in API level 1 public Drawable[] getCompoundDrawables () Returns drawables for the left, top, right, and bottom borders. Related XML Attributes:
getCompoundDrawablesRelativeAdded in API level 17 public Drawable[] getCompoundDrawablesRelative () Returns drawables for the start, top, end, and bottom borders. Related XML Attributes:
getCompoundPaddingBottomAdded in API level 1 public int getCompoundPaddingBottom () Returns the bottom padding of the view, plus space for the bottom Drawable if any.
getCompoundPaddingEndAdded in API level 17 public int getCompoundPaddingEnd () Returns the end padding of the view, plus space for the end Drawable if any.
getCompoundPaddingLeftAdded in API level 1 public int getCompoundPaddingLeft () Returns the left padding of the view, plus space for the left Drawable if any.
getCompoundPaddingRightAdded in API level 1 public int getCompoundPaddingRight () Returns the right padding of the view, plus space for the right Drawable if any.
getCompoundPaddingStartAdded in API level 17 public int getCompoundPaddingStart () Returns the start padding of the view, plus space for the start Drawable if any.
getCompoundPaddingTopAdded in API level 1 public int getCompoundPaddingTop () Returns the top padding of the view, plus space for the top Drawable if any.
getCurrentHintTextColorAdded in API level 1 public final int getCurrentHintTextColor () Return the current color selected to paint the hint text.
getCurrentTextColorAdded in API level 1 public final int getCurrentTextColor () Return the current color selected for normal text.
getCustomInsertionActionModeCallbackAdded in API level 23 public ActionMode.Callback getCustomInsertionActionModeCallback () Retrieves the value set in
getCustomSelectionActionModeCallbackAdded in API level 11 public ActionMode.Callback getCustomSelectionActionModeCallback () Retrieves the value set in
getEditableTextAdded in API level 3 public Editable getEditableText () Return the text that TextView is displaying as an Editable object. If the text is not editable, null is returned.
See also:
getEllipsizeAdded in API level 1 public TextUtils.TruncateAt getEllipsize () Returns where, if anywhere, words that are longer than the view is wide should be ellipsized.
getErrorAdded in API level 1 public CharSequence getError () Returns the error message that was set to be displayed with
getExtendedPaddingBottomAdded in API level 1 public int getExtendedPaddingBottom () 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. It is only valid to call this after measuring.
getExtendedPaddingTopAdded in API level 1 public int getExtendedPaddingTop () 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. It is only valid to call this after measuring.
getFiltersAdded in API level 1 public InputFilter[] getFilters () Returns the current list of input filters. Related XML Attributes:
getFirstBaselineToTopHeightAdded in API level 28 public int getFirstBaselineToTopHeight () Returns the distance between the first text baseline and the top of this TextView. Related XML Attributes:
See also:
getFocusedRectAdded in API level 1 public void getFocusedRect (Rect r) When a view has focus and the user navigates away from it, the next view is searched for starting from the rectangle filled in by this
method. By default, the rectangle is the
getFontFeatureSettingsAdded in API level 21 public String getFontFeatureSettings () Returns the font feature settings. The format is the same as the CSS font-feature-settings attribute: https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop
See also:
getFontVariationSettingsAdded in API level 26 public String getFontVariationSettings () Returns the font variation settings.
See also:
getFreezesTextAdded in API level 1 public boolean getFreezesText () Return whether this text view is including its entire text contents in frozen icicles. For
See also:
getGravityAdded in API level 1 public int getGravity () Returns the horizontal and vertical alignment of this TextView. Related XML Attributes:
See also:
getHighlightColorAdded in API level 16 public int getHighlightColor () Related XML Attributes:
See also:
getHintAdded in API level 1 public CharSequence getHint () Returns the hint that is displayed when the text of the TextView is empty. Related XML Attributes:
getHintTextColorsAdded in API level 1 public final ColorStateList getHintTextColors () Related XML Attributes:
See also:
getHyphenationFrequencyAdded in API level 23 public int getHyphenationFrequency () Gets the current frequency of automatic hyphenation to be used when determining word breaks. Related XML Attributes:
See also:
getImeActionIdAdded in API level 3 public int getImeActionId () Get the IME action ID previous set with
See also:
getImeActionLabelAdded in API level 3 public CharSequence getImeActionLabel () Get the IME action label previous set with
See also:
getImeHintLocalesAdded in API level 24 public LocaleList getImeHintLocales ()
See also:
getImeOptionsAdded in API level 3 public int getImeOptions () Get the type of the Input Method Editor (IME).
See also:
getIncludeFontPaddingAdded in API level 16 public boolean getIncludeFontPadding () Gets whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent. Related XML Attributes:
See also:
getInputExtrasAdded in API level 3 public Bundle getInputExtras (boolean create) Retrieve the input extras currently associated with the text view, which can be viewed as well as modified. Related XML Attributes:
See also:
getInputTypeAdded in API level 3 public int getInputType () Get the type of the editable content.
See also:
getJustificationModeAdded in API level 26 public int getJustificationMode ()
See also:
getKeyListenerAdded in API level 1 public final KeyListener getKeyListener () Gets the current Related XML Attributes:
getLastBaselineToBottomHeightAdded in API level 28 public int getLastBaselineToBottomHeight () Returns the distance between the last text baseline and the bottom of this TextView. Related XML Attributes:
See also:
getLayoutAdded in API level 1 public final Layout getLayout () Gets the
getLetterSpacingAdded in API level 21 public float getLetterSpacing () Gets the text letter-space value, which determines the spacing between characters. The value returned is in ems. Normally, this value is 0.0.
See also:
getLineBoundsAdded in API level 1 public int getLineBounds (int line, Rect bounds) 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. If the internal Layout has not been built, return 0 and set bounds to (0, 0, 0, 0)
getLineBreakStyleAdded in API level 33 public int getLineBreakStyle () Gets the current line-break style for text wrapping.
getLineBreakWordStyleAdded in API level 33 public int getLineBreakWordStyle () Gets the current line-break word style for text wrapping.
getLineCountAdded in API level 1 public int getLineCount () Return the number of lines of text, or 0 if the internal Layout has not been built.
getLineHeightAdded in API level 1 public int getLineHeight () Gets the vertical distance between lines of text, in pixels. Note that markup within the text can cause individual lines to be taller or shorter than this height, and the layout may contain additional first-or last-line padding.
getLineSpacingExtraAdded in API level 16 public float getLineSpacingExtra () Gets the line spacing extra space Related XML Attributes:
See also:
getLineSpacingMultiplierAdded in API level 16 public float getLineSpacingMultiplier () Gets the line spacing multiplier Related XML Attributes:
See also:
getLinkTextColorsAdded in API level 1 public final ColorStateList getLinkTextColors () Related XML Attributes:
See also:
getLinksClickableAdded in API level 1 public final boolean getLinksClickable () Returns whether the movement method will automatically be set to Related XML Attributes:
getMarqueeRepeatLimitAdded in API level 16 public int getMarqueeRepeatLimit () Gets the number of times the marquee animation is repeated. Only meaningful if the TextView has marquee enabled. Related XML Attributes:
See also:
getMaxEmsAdded in API level 16 public int getMaxEms () Returns the maximum width of TextView in terms of ems or -1 if the maximum width was set using Related XML Attributes:
See also:
getMaxHeightAdded in API level 16 public int getMaxHeight () Returns the maximum height of TextView in terms of pixels or -1 if the maximum height was set using Related XML Attributes:
See also:
getMaxLinesAdded in API level 16 public int getMaxLines () Returns the maximum height of TextView in terms of number of lines or -1 if the maximum height was set using Related XML Attributes:
See also:
getMaxWidthAdded in API level 16 public int getMaxWidth () Returns the maximum width of TextView in terms of pixels or -1 if the maximum width was set using Related XML Attributes:
See also:
getMinEmsAdded in API level 16 public int getMinEms () Returns the minimum width of TextView in terms of ems or -1 if the minimum width was set using Related XML Attributes:
See also:
getMinHeightAdded in API level 16 public int getMinHeight () Returns the minimum height of TextView in terms of pixels or -1 if the minimum height was set using Related XML Attributes:
See also:
getMinLinesAdded in API level 16 public int getMinLines () Returns the minimum height of TextView in terms of number of lines or -1 if the minimum height was set using Related XML Attributes:
See also:
getMinWidthAdded in API level 16 public int getMinWidth () Returns the minimum width of TextView in terms of pixels or -1 if the minimum width was set using Related XML Attributes:
See also:
getMovementMethodAdded in API level 1 public final MovementMethod getMovementMethod () Gets the
See also:
getOffsetForPositionAdded in API level 14 public int getOffsetForPosition (float x, float y) Get the character offset closest to the specified absolute position. A typical use case is to pass the result of
getPaintAdded in API level 1 public TextPaint getPaint () Gets the
getPaintFlagsAdded in API level 1 public int getPaintFlags () Gets the flags on the Paint being used to display the text.
See also:
getPrivateImeOptionsAdded in API level 3 public String getPrivateImeOptions () Get the private type of the content.
See also:
getSelectionEndAdded in API level 1 public int getSelectionEnd () Convenience for
getSelectionStartAdded in API level 1 public int getSelectionStart () Convenience for
getShadowColorAdded in API level 16 public int getShadowColor () Gets the color of the shadow layer. Related XML Attributes:
See also:
getShadowDxAdded in API level 16 public float getShadowDx () Related XML Attributes:
See also:
getShadowDyAdded in API level 16 public float getShadowDy () Gets the vertical offset of the shadow layer. Related XML Attributes:
See also:
getShadowRadiusAdded in API level 16 public float getShadowRadius () Gets the radius of the shadow layer. Related XML Attributes:
See also:
getShowSoftInputOnFocusAdded in API level 21 public final boolean getShowSoftInputOnFocus () Returns whether the soft input method will be made visible when this TextView gets focused. The default is true.
getTextAdded in API level 1 public CharSequence getText () Return the text that TextView is displaying. If The content of the return value should not be modified. If you want a modifiable one, you should make your own copy first. Related XML Attributes:
getTextClassifierAdded in API level 26 public TextClassifier getTextClassifier () Returns the
getTextColorsAdded in API level 1 public final ColorStateList getTextColors () Gets the text colors for the different states (normal, selected, focused) of the TextView. Related XML Attributes:
See also:
getTextCursorDrawableAdded in API level 29 public Drawable getTextCursorDrawable () Returns the Drawable corresponding to the text cursor. Note that any change applied to the cursor Drawable will not be visible until the cursor is hidden and then drawn again. Related XML Attributes:
See also:
getTextDirectionHeuristicAdded in API level 29 public TextDirectionHeuristic getTextDirectionHeuristic () Returns resolved
getTextLocaleAdded in API level 17 public Locale getTextLocale () Get the default primary
getTextLocalesAdded in API level 24 public LocaleList getTextLocales () Get the default
getTextMetricsParamsAdded in API level 28 public PrecomputedText.Params getTextMetricsParams () Gets the parameters for text layout precomputation, for use with
See also:
getTextScaleXAdded in API level 1 public float getTextScaleX () Gets the extent by which text should be stretched horizontally. This will usually be 1.0.
getTextSelectHandleAdded in API level 29 public Drawable getTextSelectHandle () Returns the Drawable corresponding to the selection handle used for positioning the cursor within text. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
getTextSelectHandleLeftAdded in API level 29 public Drawable getTextSelectHandleLeft () Returns the Drawable corresponding to the left handle used for selecting text. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
getTextSelectHandleRightAdded in API level 29 public Drawable getTextSelectHandleRight () Returns the Drawable corresponding to the right handle used for selecting text. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
getTextSizeAdded in API level 1 public float getTextSize ()
getTextSizeUnitAdded in API level 30 public int getTextSizeUnit () Gets the text size unit defined by the developer. It may be specified in resources or be passed as the unit argument of
See also:
getTotalPaddingBottomAdded in API level 1 public int getTotalPaddingBottom () 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.
getTotalPaddingEndAdded in API level 17 public int getTotalPaddingEnd () Returns the total end padding of the view, including the end Drawable if any.
getTotalPaddingLeftAdded in API level 1 public int getTotalPaddingLeft () Returns the total left padding of the view, including the left Drawable if any.
getTotalPaddingRightAdded in API level 1 public int getTotalPaddingRight () Returns the total right padding of the view, including the right Drawable if any.
getTotalPaddingStartAdded in API level 17 public int getTotalPaddingStart () Returns the total start padding of the view, including the start Drawable if any.
getTotalPaddingTopAdded in API level 1 public int getTotalPaddingTop () 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.
getTransformationMethodAdded in API level 1 public final TransformationMethod getTransformationMethod () Gets the current Related XML Attributes:
getTypefaceAdded in API level 1 public Typeface getTypeface () Gets the current Related XML Attributes:
See also:
getUrlsAdded in API level 1 public URLSpan[] getUrls () Returns the list of
hasOverlappingRenderingAdded in API level 16 public boolean hasOverlappingRendering () Returns whether this View has content which overlaps. This function, intended to be overridden by specific View types, is an optimization when alpha is set on a view. If rendering overlaps in a view with alpha < 1, that view is drawn to an offscreen buffer and then composited into place, which can be expensive. If the view has no overlapping rendering, the view can draw each primitive with the appropriate alpha value directly. An example of overlapping rendering is a TextView with a background image, such as a Button. An example of non-overlapping rendering is a TextView with no background, or an ImageView with only the foreground image. The default implementation returns true; subclasses should override if they have cases which can be optimized. Note: The return value of this method is ignored if
hasSelectionAdded in API level 1 public boolean hasSelection () Return true iff there is a selection of nonzero length inside this text view.
invalidateDrawableAdded in API level 1 public void invalidateDrawable (Drawable drawable) Invalidates the specified Drawable.
isAllCapsAdded in API level 28 public boolean isAllCaps () Checks whether the transformation method applied to this TextView is set to ALL CAPS.
See also:
isCursorVisibleAdded in API level 16 public boolean isCursorVisible () Related XML Attributes:
See also:
isElegantTextHeightAdded in API level 28 public boolean isElegantTextHeight () Get the value of the TextView's elegant height metrics flag. This setting selects font variants that have not been compacted to fit Latin-based vertical metrics, and also increases top and bottom bounds to provide more space.
See also:
isFallbackLineSpacingAdded in API level 28 public boolean isFallbackLineSpacing () Related XML Attributes:
See also:
isHorizontallyScrollableAdded in API level 29 public final boolean isHorizontallyScrollable () Returns whether the text is allowed to be wider than the View. If false, the text will be wrapped to the width of the View. Related XML Attributes:
See also:
isInputMethodTargetAdded in API level 3 public boolean isInputMethodTarget () Returns whether this text view is a current input method target. The default implementation just checks with
isSingleLineAdded in API level 29 public boolean isSingleLine () Returns if the text is constrained to a single horizontally scrolling line ignoring new line characters instead of letting it wrap onto multiple lines. Related XML Attributes:
isSuggestionsEnabledAdded in API level 14 public boolean isSuggestionsEnabled () Return whether or not suggestions are enabled on this TextView. The suggestions are generated by the IME or by the spell checker as the user types. This is done by adding
isTextSelectableAdded in API level 11 public boolean isTextSelectable () Returns the state of the Related XML Attributes:
jumpDrawablesToCurrentStateAdded in API level 11 public void jumpDrawablesToCurrentState () Call Also calls lengthAdded in API level 1 public int length () Returns the length, in characters, of the text managed by this TextView
moveCursorToVisibleOffsetAdded in API level 3 public boolean moveCursorToVisibleOffset () Move the cursor, if needed, so that it is at an offset that is visible to the user. This will not move the cursor if it represents more than one character (a selection range). This will only work if the TextView contains spannable text; otherwise it will do nothing.
onBeginBatchEditAdded in API level 3 public void onBeginBatchEdit () Called by the framework in response to a request to begin a batch of edit operations through a call to link onCheckIsTextEditorAdded in API level 3 public boolean onCheckIsTextEditor () Check whether the called view is a text editor, in which case it would make sense to automatically display a soft input window for it. Subclasses should override this if they implement The default implementation always returns false. This does not mean that its
onCommitCompletionAdded in API level 3 public void onCommitCompletion (CompletionInfo text) Called by the framework in response to a text completion from the current input method, provided by it calling
onCommitCorrectionAdded in API level 11 public void onCommitCorrection (CorrectionInfo info) 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
onCreateInputConnectionAdded in API level 3 public InputConnection onCreateInputConnection (EditorInfo outAttrs) Create a new InputConnection for an InputMethod to interact with the view. The default implementation returns null, since it doesn't support input methods. You can override this to implement such support. This is only needed for views that take focus and text input. When implementing this, you probably also want to implement Also, take good care to fill in the
onCreateViewTranslationRequestAdded in API level 31 public void onCreateViewTranslationRequest (int[] supportedFormats, Consumer<ViewTranslationRequest> requestsCollector) Collects a NOTE: When overriding the method, it should not collect a request to translate this TextView if it is displaying a password.
onDragEventAdded in API level 11 public boolean onDragEvent (DragEvent event) Handles drag events sent by the system following a call to If this text view is not editable, delegates to the default If this text view is editable,
accepts all drag actions (returns true for an
onEditorActionAdded in API level 3 public void onEditorAction (int actionCode) Called when an attached input method calls For backwards compatibility, if no IME options have been set and the text view would not normally advance focus on enter, then the NEXT and DONE actions received here will be turned into an enter key down/up pair to go through the normal key handling.
See also:
onEndBatchEditAdded in API level 3 public void onEndBatchEdit () Called by the framework in response to a request to end a batch of edit operations through a call to link onGenericMotionEventAdded in API level 12 public boolean onGenericMotionEvent (MotionEvent event) Implement this method to handle generic motion events. Generic motion events describe joystick movements, mouse hovers, track pad touches, scroll wheel movements and other input events. The Generic motion events with source class public boolean onGenericMotionEvent(MotionEvent event) { if (event.isFromSource(InputDevice.SOURCE_CLASS_JOYSTICK)) { if (event.getAction() == MotionEvent.ACTION_MOVE) { // process the joystick movement... return true; } } if (event.isFromSource(InputDevice.SOURCE_CLASS_POINTER)) { switch (event.getAction()) { case MotionEvent.ACTION_HOVER_MOVE: // process the mouse hover movement... return true; case MotionEvent.ACTION_SCROLL: // process the scroll wheel movement... return true; } } return super.onGenericMotionEvent(event); }
onKeyDownAdded in API level 1 public boolean onKeyDown (int keyCode, KeyEvent event) Default implementation of Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onKeyMultipleAdded in API level 1 public boolean onKeyMultiple (int keyCode, int repeatCount, KeyEvent event) Default implementation of Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onKeyPreImeAdded in API level 3 public boolean onKeyPreIme (int keyCode, KeyEvent event) Handle a key event before it is processed by any input method associated with the view hierarchy. This can be used to intercept key events in special situations before the IME consumes them; a typical example would be handling the BACK key to update the application's UI instead of allowing the IME to see it and close itself.
onKeyShortcutAdded in API level 1 public boolean onKeyShortcut (int keyCode, KeyEvent event) Called on the focused view when a key shortcut event is not handled. Override this method to implement local key shortcuts for the View. Key shortcuts can also be implemented by setting the
onKeyUpAdded in API level 1 public boolean onKeyUp (int keyCode, KeyEvent event) Default implementation of Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
onPreDrawAdded in API level 1 public boolean onPreDraw () Callback method to be invoked when the view tree is about to be drawn. At this point, all views in the tree have been measured and given a frame. Clients can use this to adjust their scroll bounds or even to request a new layout before drawing occurs.
onPrivateIMECommandAdded in API level 3 public boolean onPrivateIMECommand (String action, Bundle data) Called by the framework in response to a private command from the current method, provided by it calling
onReceiveContentAdded in API level 31 public ContentInfo onReceiveContent (ContentInfo payload) Default For non-editable TextViews the default behavior is a no-op (returns the passed-in content without acting on it). For editable TextViews the default behavior is to insert text into the view, coercing non-text content to text as needed. The MIME types "text/plain" and "text/html" have well-defined behavior for this, while other MIME types have reasonable fallback behavior (see
onResolvePointerIconAdded in API level 24 public PointerIcon onResolvePointerIcon (MotionEvent event, int pointerIndex) Returns the pointer icon for the motion event, or null if it doesn't specify the icon. The default implementation does not care the location or event types, but some subclasses may use it (such as WebViews).
onRestoreInstanceStateAdded in API level 1 public void onRestoreInstanceState (Parcelable state) Hook allowing a view to re-apply a representation of its internal state that had previously been generated by
onRtlPropertiesChangedAdded in API level 17 public void onRtlPropertiesChanged (int layoutDirection) Called when any RTL property (layout direction or text direction or text alignment) has been changed. Subclasses need to override this method to take care of cached information that depends on the resolved layout direction, or to inform child views that inherit their layout direction. The default implementation does nothing.
onSaveInstanceStateAdded in API level 1 public Parcelable onSaveInstanceState () Hook allowing a view to generate a representation of its internal state that can later be used to create a new instance with that same state. This state should only contain information that is not persistent or can not be reconstructed later. For example, you will never store your current position on screen because that will be computed again when a new instance of the view is placed in its view hierarchy. Some examples of things you may store here: the current cursor position in a text view (but usually not the text itself since that is stored in a content provider or other persistent storage), the currently selected item in a list view.
onScreenStateChangedAdded in API level 16 public void onScreenStateChanged (int screenState) This method is called whenever the state of the screen this view is attached to changes. A state change will usually occurs when the screen turns on or off (whether it happens automatically or the user does it manually.)
onTextContextMenuItemAdded in API level 3 public boolean onTextContextMenuItem (int id) Called when a context menu option for the text view is selected. Currently this will be one of
onTouchEventAdded in API level 1 public boolean onTouchEvent (MotionEvent event) Implement this method to handle touch screen motion events. If this method is used to detect click actions, it is recommended that the actions be performed by implementing and calling
onTrackballEventAdded in API level 1 public boolean onTrackballEvent (MotionEvent event) Implement this method to handle trackball motion events. The relative movement of the trackball since the last event can be retrieve with
onVisibilityAggregatedAdded in API level 24 public void onVisibilityAggregated (boolean isVisible) Called when the user-visibility of this View is potentially affected by a change to this view itself, an ancestor view or the window this view is attached to.
onWindowFocusChangedAdded in API level 1 public void onWindowFocusChanged (boolean hasWindowFocus) Called when the window containing this view gains or loses focus. Note that this is separate from view focus: to receive key events, both your view and its window must have focus. If a window is displayed on top of yours that takes input focus, then your own window will lose focus but the view focus will remain unchanged.
performLongClickAdded in API level 1 public boolean performLongClick () Calls this view's OnLongClickListener, if it is defined. Invokes the context menu if the OnLongClickListener did not consume the event.
removeTextChangedListenerAdded in API level 1 public void removeTextChangedListener (TextWatcher watcher) Removes the specified TextWatcher from the list of those whose methods are called whenever this TextView's text changes.
sendAccessibilityEventUncheckedAdded in API level 4 public void sendAccessibilityEventUnchecked (AccessibilityEvent event) This method behaves exactly as If an
setAllCapsAdded in API level 14 public void setAllCaps (boolean allCaps) Sets the properties of this field to transform input to ALL CAPS display. This may use a "small caps" formatting if available. This setting will be ignored if this field is editable or selectable. This call replaces the current transformation method. Disabling this will not necessarily restore the previous behavior from before this was enabled. Related XML Attributes:
See also:
setAutoLinkMaskAdded in API level 1 public final void setAutoLinkMask (int mask) Sets the autolink mask of the text. See Note: Related XML Attributes:
setAutoSizeTextTypeUniformWithConfigurationAdded in API level 26 public void setAutoSizeTextTypeUniformWithConfiguration (int autoSizeMinTextSize, int autoSizeMaxTextSize, int autoSizeStepGranularity, int unit) Specify whether this widget should automatically scale the text to try to perfectly fit within the layout
bounds. If all the configuration params are valid the type of auto-size is set to Related XML Attributes:
See also:
setAutoSizeTextTypeUniformWithPresetSizesAdded in API level 26 public void setAutoSizeTextTypeUniformWithPresetSizes (int[] presetSizes, int unit) Specify whether this widget should automatically scale the text to try to perfectly fit within the layout bounds. If at least one value from the Related XML Attributes:
See also:
setAutoSizeTextTypeWithDefaultsAdded in API level 26 public void setAutoSizeTextTypeWithDefaults (int autoSizeTextType) 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. Related XML Attributes:
See also:
setBreakStrategyAdded in API level 23 public void setBreakStrategy (int breakStrategy) Sets the break strategy for breaking paragraphs into lines. The default value for TextView is Enabling hyphenation with either using Compared with
Related XML Attributes:
See also:
setCompoundDrawablePaddingAdded in API level 1 public void setCompoundDrawablePadding (int pad) Sets the size of the padding between the compound drawables and the text. Related XML Attributes:
setCompoundDrawableTintBlendModeAdded in API level 29 public void setCompoundDrawableTintBlendMode (BlendMode blendMode) Specifies the blending mode used to apply the tint specified by Related XML Attributes:
See also:
setCompoundDrawableTintListAdded in API level 23 public void setCompoundDrawableTintList (ColorStateList tint) Applies a tint to the compound drawables. Does not modify the
current tint mode, which is Subsequent calls to Related XML Attributes:
See also:
setCompoundDrawableTintModeAdded in API level 23 public void setCompoundDrawableTintMode (PorterDuff.Mode tintMode) Specifies the blending mode used to apply the tint specified by
Related XML Attributes:
See also:
setCompoundDrawablesAdded in API level 1 public void setCompoundDrawables (Drawable left, Drawable top, Drawable right, Drawable bottom) Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use Calling this method will overwrite any Drawables previously set using Related XML Attributes:
setCompoundDrawablesRelativeAdded in API level 17 public void setCompoundDrawablesRelative (Drawable start, Drawable top, Drawable end, Drawable bottom) Sets the Drawables (if
any) to appear to the start of, above, to the end of, and below the text. Use Calling this method will overwrite any Drawables previously set using Related XML Attributes:
setCompoundDrawablesRelativeWithIntrinsicBoundsAdded in API level 17 public void setCompoundDrawablesRelativeWithIntrinsicBounds (Drawable start, Drawable top, Drawable end, Drawable bottom) Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text. Use Calling this method will overwrite any Drawables previously set using Related XML Attributes:
setCompoundDrawablesRelativeWithIntrinsicBoundsAdded in API level 17 public void setCompoundDrawablesRelativeWithIntrinsicBounds (int start, int top, int end, int bottom) Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text. Use 0 if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds. Calling this method will overwrite any Drawables previously set using Related XML Attributes:
setCompoundDrawablesWithIntrinsicBoundsAdded in API level 1 public void setCompoundDrawablesWithIntrinsicBounds (Drawable left, Drawable top, Drawable right, Drawable bottom) Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use Calling this method will overwrite any Drawables previously set using Related XML Attributes:
setCompoundDrawablesWithIntrinsicBoundsAdded in API level 3 public void setCompoundDrawablesWithIntrinsicBounds (int left, int top, int right, int bottom) Sets the Drawables (if any) to appear to the left of, above, to the right of, and below the text. Use 0 if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds. Calling this method will overwrite any Drawables previously set using Related XML Attributes:
setCursorVisibleAdded in API level 1 public void setCursorVisible (boolean visible) Set whether the cursor is visible. The default is true. Note that this property only makes sense for editable TextView. If IME is consuming the input, the cursor will always be invisible, visibility will be updated as the last state when IME does not consume the input anymore. Related XML Attributes:
See also:
setCustomInsertionActionModeCallbackAdded in API level 23 public void setCustomInsertionActionModeCallback (ActionMode.Callback actionModeCallback) If provided, this ActionMode.Callback will be used to create the ActionMode when text insertion is initiated in this View. The standard implementation populates the menu with a subset of Select All, Paste and Replace actions, depending on what this View supports. A custom implementation can add new entries in the default menu in its Returning false from
Action click events should be handled by the custom implementation of Note that text insertion mode is not started when a TextView receives focus and the
setCustomSelectionActionModeCallbackAdded in API level 11 public void setCustomSelectionActionModeCallback (ActionMode.Callback actionModeCallback) If provided, this ActionMode.Callback will be used to create the ActionMode when text selection is initiated in this View. The standard implementation populates the menu with a subset of Select All, Cut, Copy, Paste, Replace and Share actions, depending on what this View supports. A custom implementation can add new entries in the default menu in its Returning false from
Action click events should be handled by the custom implementation of Note that text selection mode is not started when a TextView receives focus and
the
setEditableFactoryAdded in API level 1 public final void setEditableFactory (Editable.Factory factory) Sets the Factory used to create new
See also:
setElegantTextHeightAdded in API level 21 public void setElegantTextHeight (boolean elegant) Set the TextView's elegant height metrics flag. This setting selects font variants that have not been compacted to fit Latin-based vertical metrics, and also increases top and bottom bounds to provide more space. Related XML Attributes:
See also:
setEllipsizeAdded in API level 1 public void setEllipsize (TextUtils.TruncateAt where) Causes words in the text that are longer than the view's width to be ellipsized instead of broken in the middle.
You may also want to Related XML Attributes:
setEmsAdded in API level 1 public void setEms (int ems) Sets the width of the TextView to be exactly Related XML Attributes:
See also:
setEnabledAdded in API level 1 public void setEnabled (boolean enabled) Set the enabled state of this view. The interpretation of the enabled state varies by subclass.
setErrorAdded in API level 1 public void setError (CharSequence error) 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. The icon and error message will be reset to null
when any key events cause changes to the TextView's text. If the
setErrorAdded in API level 1 public void setError (CharSequence error, Drawable icon) 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. The icon
and error message will be reset to null when any key events cause changes to the TextView's text. The drawable must already have had
setExtractedTextAdded in API level 3 public void setExtractedText (ExtractedText text) Apply to this text view the given extracted text, as previously returned by
setFallbackLineSpacingAdded in API level 28 public void setFallbackLineSpacing (boolean enabled) 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). If set, fallback fonts that end up getting used can increase the ascent and descent of the lines that they are used on. It is required to be true if text could be in languages like Burmese or Tibetan where text is typically much taller or deeper than Latin text. Related XML Attributes:
See also:
setFiltersAdded in API level 1 public void setFilters (InputFilter[] filters) Sets the list of input filters that will be used if the buffer is Editable. Has no effect otherwise. Related XML Attributes:
setFirstBaselineToTopHeightAdded in API level 28 public void setFirstBaselineToTopHeight (int firstBaselineToTopHeight) Updates the top padding of the TextView so that First and last baseline metrics for a TextView. Note that if Related XML Attributes:
See also:
setFontFeatureSettingsAdded in API level 21 public void setFontFeatureSettings (String fontFeatureSettings) Sets font feature settings. The format is the same as the CSS font-feature-settings attribute: https://www.w3.org/TR/css-fonts-3/#font-feature-settings-prop Related XML Attributes:
See also:
setFontVariationSettingsAdded in API level 26 public boolean setFontVariationSettings (String fontVariationSettings) Sets TrueType or OpenType font variation settings. The settings string is constructed from multiple pairs of axis tag and style values. The axis tag must contain four ASCII characters and must be wrapped with single quotes (U+0027) or double quotes (U+0022). Axis strings that are longer or shorter than four characters, or contain characters outside of U+0020..U+007E are invalid. If a specified axis name is not defined in the font, the settings will be ignored. Examples,
Related XML Attributes:
See also:
setFreezesTextAdded in API level 1 public void setFreezesText (boolean freezesText) Control whether this text view saves its entire text contents when freezing to an icicle, in addition to dynamic state such as cursor
position. By default this is false, not saving the text. Set to true if the text in the text view is not being saved somewhere else in persistent storage (such as in a content provider) so that if the view is later thawed the user will not lose their data. For Related XML Attributes:
setGravityAdded in API level 1 public void setGravity (int gravity) 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. Related XML Attributes:
See also:
setHeightAdded in API level 1 public void setHeight (int pixels) Sets the height of the TextView to be exactly This value is used for height calculation if LayoutParams does not force TextView to have an exact
height. Setting this value overrides previous minimum/maximum height configurations such as Related XML Attributes:
See also:
setHighlightColorAdded in API level 1 public void setHighlightColor (int color) Sets the color used to display the selection highlight. Related XML Attributes:
setHintAdded in API level 1 public final void setHint (CharSequence hint) Sets the text to be displayed when the text of the TextView is empty. Null means to use the normal empty text. The hint does not currently participate in determining the size of the view. Related XML Attributes:
setHintAdded in API level 1 public final void setHint (int resid) Sets the text to be displayed when the text of the TextView is empty, from a resource. Related XML Attributes:
setHintTextColorAdded in API level 1 public final void setHintTextColor (ColorStateList colors) Sets the color of the hint text. Related XML Attributes:
See also:
setHintTextColorAdded in API level 1 public final void setHintTextColor (int color) Sets the color of the hint text for all the states (disabled, focussed, selected...) of this TextView. Related XML Attributes:
See also:
setHorizontallyScrollingAdded in API level 1 public void setHorizontallyScrolling (boolean whether) Sets whether the text should be allowed to be wider than the View is. If false, it will be wrapped to the width of the View. Related XML Attributes:
setHyphenationFrequencyAdded in API level 23 public void setHyphenationFrequency (int hyphenationFrequency) Sets the frequency of automatic hyphenation to use when determining word breaks. The default value for both TextView and Enabling hyphenation with either using Note: Before Android Q, in the theme hyphenation frequency is set to Related XML Attributes:
See also:
setImeActionLabelAdded in API level 3 public void setImeActionLabel (CharSequence label, int actionId) Change the custom IME action associated with the text view, which will be reported to an IME with
Related XML Attributes:
See also:
setImeHintLocalesAdded in API level 24 public void setImeHintLocales (LocaleList hintLocales) Change "hint" locales associated with the text view, which will be reported to an IME with
Note: If you want new "hint" to take effect immediately you need to call
See also:
setImeOptionsAdded in API level 3 public void setImeOptions (int imeOptions) Change the editor type integer associated with the text view, which is reported to an Input Method Editor (IME) with Related XML Attributes:
See also:
setIncludeFontPaddingAdded in API level 1 public void setIncludeFontPadding (boolean includepad) Set whether the TextView includes extra top and bottom padding to make room for accents that go above the normal ascent and descent. The default is true. Related XML Attributes:
See also:
setInputExtrasAdded in API level 3 public void setInputExtras (int xmlResId) Set the extra input data of the text, which is the Related XML Attributes:
See also:
setInputTypeAdded in API level 3 public void setInputType (int type) Set the type of the content with a constant as defined for Related XML Attributes:
See also:
setJustificationModeAdded in API level 26 public void setJustificationMode (int justificationMode) Set justification mode. The default value is
See also:
setKeyListenerAdded in API level 1 public void setKeyListener (KeyListener input) Sets the key listener to be used with this TextView. This can be null to disallow user input. Note that this method has
significant and subtle interactions with soft keyboards and other input method: see Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call Related XML Attributes:
setLastBaselineToBottomHeightAdded in API level 28 public void setLastBaselineToBottomHeight (int lastBaselineToBottomHeight) Updates the bottom padding of the TextView so that First and last baseline metrics for a TextView. Note that if Related XML Attributes:
See also:
setLetterSpacingAdded in API level 21 public void setLetterSpacing (float letterSpacing) Sets text letter-spacing in em units. Typical values for slight expansion will be around 0.05. Negative values tighten text. Related XML Attributes:
See also:
setLineBreakStyleAdded in API level 33 public void setLineBreakStyle (int lineBreakStyle) Sets the line-break style for text wrapping. Line-break style specifies the line-break strategies that can be used for text wrapping. The line-break style affects rule-based line breaking by specifying the strictness of line-breaking rules. The following are types of line-break styles:
The default line-break style is See the line-break property for more information.
setLineBreakWordStyleAdded in API level 33 public void setLineBreakWordStyle (int lineBreakWordStyle) Sets the line-break word style for text wrapping. The line-break word style affects dictionary-based line breaking by providing phrase-based line-breaking opportunities. Use The default line-break word style is See the word-break property for more information.
setLineHeightAdded in API level 28 public void setLineHeight (int lineHeight) Sets an explicit line height for this TextView. This is equivalent to the vertical distance between subsequent baselines in the TextView. Related XML Attributes:
See also:
setLineSpacingAdded in API level 1 public void setLineSpacing (float add, float mult) Sets line spacing for this TextView. Each line other than the last line will have its height multiplied by Related XML Attributes:
setLinesAdded in API level 1 public void setLines (int lines) Sets the height of the TextView to be exactly This value is used for height calculation if LayoutParams does not force TextView to have an exact height. Setting this value overrides previous minimum/maximum
height configurations such as Related XML Attributes:
See also:
setLinkTextColorAdded in API level 1 public final void setLinkTextColor (ColorStateList colors) Sets the color of links in the text. Related XML Attributes:
See also:
setLinkTextColorAdded in API level 1 public final void setLinkTextColor (int color) Sets the color of links in the text. Related XML Attributes:
See also:
setLinksClickableAdded in API level 1 public final void setLinksClickable (boolean whether) Sets whether the movement method will automatically be set to Related XML Attributes:
setMarqueeRepeatLimitAdded in API level 2 public void setMarqueeRepeatLimit (int marqueeLimit) Sets how many times to repeat the marquee animation. Only applied if the TextView has marquee enabled. Set to -1 to repeat indefinitely. Related XML Attributes:
See also:
setMaxEmsAdded in API level 1 public void setMaxEms (int maxEms) Sets the width of the TextView to be at most This value is used for width calculation if LayoutParams does not force TextView to have an exact
width. Setting this value overrides previous maximum width configurations such as Related XML Attributes:
See also:
setMaxHeightAdded in API level 1 public void setMaxHeight (int maxPixels) Sets the height of the TextView to be at most This value is used for height calculation if LayoutParams does not force
TextView to have an exact height. Setting this value overrides previous maximum height configurations such as Related XML Attributes:
See also:
setMaxLinesAdded in API level 1 public void setMaxLines (int maxLines) Sets the height of the TextView to be at most This value is used for height calculation if LayoutParams does not force
TextView to have an exact height. Setting this value overrides previous maximum height configurations such as Related XML Attributes:
See also:
setMaxWidthAdded in API level 1 public void setMaxWidth (int maxPixels) Sets the width of the TextView to be at most This value is used for width calculation if LayoutParams does not force
TextView to have an exact width. Setting this value overrides previous maximum width configurations such as Related XML Attributes:
See also:
setMinEmsAdded in API level 1 public void setMinEms (int minEms) Sets the width of the TextView to be at least This value is used for width calculation if LayoutParams does not force TextView to
have an exact width. Setting this value overrides previous minimum width configurations such as Related XML Attributes:
See also:
setMinHeightAdded in API level 1 public void setMinHeight (int minPixels) Sets the height of the TextView to be at least This value is used for height calculation if LayoutParams does not force
TextView to have an exact height. Setting this value overrides previous minimum height configurations such as The value given here is different than Related XML Attributes:
See also:
setMinLinesAdded in API level 1 public void setMinLines (int minLines) Sets the height of the TextView to be at least This value is used for height calculation if LayoutParams does not force
TextView to have an exact height. Setting this value overrides other previous minimum height configurations such as Related XML Attributes:
See also:
setMinWidthAdded in API level 1 public void setMinWidth (int minPixels) Sets the width of the TextView to be at least This value is used for width calculation if LayoutParams does not force
TextView to have an exact width. Setting this value overrides previous minimum width configurations such as The value given here is different than Related XML Attributes:
See also:
setMovementMethodAdded in API level 1 public final void setMovementMethod (MovementMethod movement) Sets the Be warned that if you want a TextView with a key listener or movement method not to be focusable, or if you want a TextView without a key listener or movement method to be focusable, you must call
setOnEditorActionListenerAdded in API level 3 public void setOnEditorActionListener (TextView.OnEditorActionListener l) Set a special listener to be called when an action is performed on the text view. This will be called when the enter key is pressed, or when an action supplied to the IME is selected by the user. Setting this means that the normal hard key event will not insert a newline into the text view, even if it is multi-line; holding down the ALT modifier will, however, allow the user to insert a newline character.
setPaddingAdded in API level 1 public void setPadding (int left, int top, int right, int bottom) Sets the padding. The view may add on the space required to display the scrollbars, depending on the style and visibility of the scrollbars. So the values returned from
See also:
setPaddingRelativeAdded in API level 16 public void setPaddingRelative (int start, int top, int end, int bottom) Sets the relative padding. The view may add on the space required to display the scrollbars, depending
on the style and visibility of the scrollbars. So the values returned from
See also:
setPaintFlagsAdded in API level 1 public void setPaintFlags (int flags) Sets flags on the Paint being used to display the text and reflows the text if they are different from the old flags.
See also:
setPrivateImeOptionsAdded in API level 3 public void setPrivateImeOptions (String type) Set the private content type of the text, which is the Related XML Attributes:
See also:
setRawInputTypeAdded in API level 3 public void setRawInputType (int type) Directly change the content type integer of the text view, without modifying any other state. Related XML Attributes:
See also:
setScrollerAdded in API level 1 public void setScroller (Scroller s) Sets the Scroller used for producing a scrolling animation
setSelectAllOnFocusAdded in API level 1 public void setSelectAllOnFocus (boolean selectAllOnFocus) Set the TextView so that when it takes focus, all the text is selected. Related XML Attributes:
setSelectedAdded in API level 1 public void setSelected (boolean selected) Changes the selection state of this view. A view can be selected or not. Note that selection is not the same as focus. Views are typically selected in the context of an AdapterView like ListView or GridView; the selected view is the view that is highlighted.
setShadowLayerAdded in API level 1 public void setShadowLayer (float radius, float dx, float dy, int color) Gives the text a shadow of the specified blur radius and color, the specified distance from its drawn position. The text shadow produced does not interact with the properties on
view that are responsible for real time shadows, Related XML Attributes:
See also:
setShowSoftInputOnFocusAdded in API level 21 public final void setShowSoftInputOnFocus (boolean show) Sets whether the soft input method will be made visible when this TextView gets focused. The default is true.
setSingleLineAdded in API level 1 public void setSingleLine (boolean singleLine) 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. Note that the default conditions are not necessarily those that were in effect prior this method, and you may want to reset these properties to your custom values. Note that due to performance reasons, by setting single line for the EditText, the maximum text length is set to 5000 if no other character limitation are applied. Related XML Attributes:
setSingleLineAdded in API level 1 public void setSingleLine () Sets the properties of this field (lines, horizontally scrolling, transformation method) to be for a single-line input. Related XML Attributes:
setSpannableFactoryAdded in API level 1 public final void setSpannableFactory (Spannable.Factory factory) Sets the Factory used to create new
See also:
setTextAdded in API level 1 public final void setText (int resid) Sets the text to be displayed using a string resource identifier. Related XML Attributes:
See also:
setTextAdded in API level 1 public final void setText (CharSequence text) Sets the text to be displayed. TextView does not accept HTML-like formatting, which you can do with text strings in XML resource files. To style
your strings, attach android.text.style.* objects to a When required, TextView will use Related XML Attributes:
setTextAdded in API level 1 public void setText (CharSequence text, TextView.BufferType type) Sets the text to be displayed and the When required, TextView will use Related XML Attributes:
See also:
setTextAdded in API level 1 public final void setText (int resid, TextView.BufferType type) Sets the text to be displayed using a string resource identifier and the When required, TextView will use Related XML Attributes:
See also:
setTextAdded in API level 1 public final void setText (char[] text, int start, int len) Sets the TextView to display the specified slice of the specified char array. You must promise that you will not change the contents of the array except for right before another call to setText(), since the TextView has no way to know that the text has changed and that it needs to invalidate and re-layout.
setTextAppearance Added in API level 1 public void setTextAppearance (Context context, int resId)
This method was deprecated in API level 23. Sets the text color, size, style, hint color, and highlight color from the specified TextAppearance resource.
setTextAppearanceAdded in API level 23 public void setTextAppearance (int resId) Sets the text appearance from the specified style resource. Use a framework-defined Related XML Attributes:
setTextClassifierAdded in API level 26 public void setTextClassifier (TextClassifier textClassifier) Sets the
setTextColorAdded in API level 1 public void setTextColor (int color) Sets the text color for all the states (normal, selected, focused) to be this color. Related XML Attributes:
See also:
setTextColorAdded in API level 1 public void setTextColor (ColorStateList colors) Sets the text color. Related XML Attributes:
See also:
setTextCursorDrawableAdded in API level 29 public void setTextCursorDrawable (Drawable textCursorDrawable) Sets the Drawable corresponding to the text cursor. The Drawable defaults to the value of the textCursorDrawable attribute. Note that any change applied to the cursor Drawable will not be visible until the cursor is hidden and then drawn again. Related XML Attributes:
See also:
setTextCursorDrawableAdded in API level 29 public void setTextCursorDrawable (int textCursorDrawable) Sets the Drawable corresponding to the text cursor. The Drawable defaults to the value of the textCursorDrawable attribute. Note that any change applied to the cursor Drawable will not be visible until the cursor is hidden and then drawn again. Related XML Attributes:
See also:
setTextIsSelectableAdded in API level 11 public void setTextIsSelectable (boolean selectable) Sets whether the content of this view is selectable by the user. The default is When you use a TextView to display a useful piece of information to the user (such as a contact's address), make it selectable, so that the user can select and copy its content. You can also use set the XML attribute When you call this method to set the value of
setTextKeepStateAdded in API level 1 public final void setTextKeepState (CharSequence text) Sets the text to be displayed but retains the cursor position. Same as When required, TextView will use
See also:
setTextKeepStateAdded in API level 1 public final void setTextKeepState (CharSequence text, TextView.BufferType type) Sets the text to be displayed and the When required, TextView will use
See also:
setTextLocaleAdded in API level 17 public void setTextLocale (Locale locale) Set the default
See also:
setTextLocalesAdded in API level 24 public void setTextLocales (LocaleList locales) Set the default
See also:
setTextMetricsParamsAdded in API level 28 public void setTextMetricsParams (PrecomputedText.Params params) Apply the text layout parameter. Update the TextView parameters to be compatible with
See also:
setTextScaleXAdded in API level 1 public void setTextScaleX (float size) Sets the horizontal scale factor for text. The default value is 1.0. Values greater than 1.0 stretch the text wider. Values less than 1.0 make the text narrower. By default, this value is 1.0. Related XML Attributes:
setTextSelectHandleAdded in API level 29 public void setTextSelectHandle (int textSelectHandle) Sets the Drawable corresponding to the selection handle used for positioning the cursor within text. The Drawable defaults to the value of the textSelectHandle attribute. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
setTextSelectHandleAdded in API level 29 public void setTextSelectHandle (Drawable textSelectHandle) Sets the Drawable corresponding to the selection handle used for positioning the cursor within text. The Drawable defaults to the value of the textSelectHandle attribute. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
setTextSelectHandleLeftAdded in API level 29 public void setTextSelectHandleLeft (int textSelectHandleLeft) Sets the Drawable corresponding to the left handle used for selecting text. The Drawable defaults to the value of the textSelectHandleLeft attribute. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
setTextSelectHandleLeftAdded in API level 29 public void setTextSelectHandleLeft (Drawable textSelectHandleLeft) Sets the Drawable corresponding to the left handle used for selecting text. The Drawable defaults to the value of the textSelectHandleLeft attribute. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
setTextSelectHandleRightAdded in API level 29 public void setTextSelectHandleRight (Drawable textSelectHandleRight) Sets the Drawable corresponding to the right handle used for selecting text. The Drawable defaults to the value of the textSelectHandleRight attribute. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
setTextSelectHandleRightAdded in API level 29 public void setTextSelectHandleRight (int textSelectHandleRight) Sets the Drawable corresponding to the right handle used for selecting text. The Drawable defaults to the value of the textSelectHandleRight attribute. Note that any change applied to the handle Drawable will not be visible until the handle is hidden and then drawn again. Related XML Attributes:
See also:
setTextSizeAdded in API level 1 public void setTextSize (int unit, float size) Set the default text size to a given unit and value. See Note: if this TextView has the auto-size feature enabled, then this function is no-op. Related XML Attributes:
setTextSizeAdded in API level 1 public void setTextSize (float size) Set the default text size to the given value, interpreted as "scaled pixel" units. This size is adjusted based on the current density and user font size preference. Note: if this TextView has the auto-size feature enabled, then this function is no-op. Related XML Attributes:
setTransformationMethodAdded in API level 1 public final void setTransformationMethod (TransformationMethod method) Sets the transformation that is applied to the text that this TextView is displaying. Related XML Attributes:
setTypefaceAdded in API level 1 public void setTypeface (Typeface tf) Sets the typeface and style in which the text should be displayed. Note that not all Typeface families actually have bold and italic variants, so you may need to use Related XML Attributes:
See also:
setTypefaceAdded in API level 1 public void setTypeface (Typeface tf, int style) 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. Related XML Attributes:
setWidthAdded in API level 1 public void setWidth (int pixels) Sets the width of the TextView to be exactly This value is used for width calculation if LayoutParams does not force TextView to have an exact width. Setting this value overrides previous minimum/maximum width
configurations such as Related XML Attributes:
See also:
showContextMenuAdded in API level 1 public boolean showContextMenu () Shows the context menu for this view.
showContextMenuAdded in API level 24 public boolean showContextMenu (float x, float y) Shows the context menu for this view anchored to the specified view-relative coordinate.
Protected methodscomputeHorizontalScrollRangeAdded in API level 1 protected int computeHorizontalScrollRange () Compute the horizontal range that the horizontal scrollbar represents. The range is
expressed in arbitrary units that must be the same as the units used by The default range is the drawing width of this view.
computeVerticalScrollExtentAdded in API level 1 protected int computeVerticalScrollExtent () Compute the vertical extent of the vertical scrollbar's thumb within the vertical range. This value is used to compute the length of the thumb within the scrollbar's track. The
range is expressed in arbitrary units that must be the same as the units used by The default extent is the drawing height of this view.
computeVerticalScrollRangeAdded in API level 1 protected int computeVerticalScrollRange () Compute the vertical range that the vertical scrollbar represents. The range is expressed in arbitrary units that must be the same as the units used by
drawableStateChangedAdded in API level 1 protected void drawableStateChanged () This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown. If the View has a StateListAnimator, it will also be called to run necessary state change animations. Be sure to call through to the superclass when overriding this function. getBottomPaddingOffsetAdded in API level 2 protected int getBottomPaddingOffset () Amount by which to extend the bottom fading region. Called only when
getDefaultEditableAdded in API level 1 protected boolean getDefaultEditable () Subclasses override this to specify that they have a KeyListener by default even if not specifically called for in the XML options.
getDefaultMovementMethodAdded in API level 1 protected MovementMethod getDefaultMovementMethod () Subclasses override this to specify a default movement method.
getLeftFadingEdgeStrengthAdded in API level 1 protected float getLeftFadingEdgeStrength () Returns the strength, or intensity, of the left faded edge. The strength is a value between 0.0 (no fade) and 1.0 (full fade). The default implementation returns 0.0 or 1.0 but no value in between. Subclasses should override this method to provide a smoother fade transition when scrolling occurs.
getLeftPaddingOffsetAdded in API level 2 protected int getLeftPaddingOffset () Amount by which to extend the left fading region. Called only when
getRightFadingEdgeStrengthAdded in API level 1 protected float getRightFadingEdgeStrength () Returns the strength, or intensity, of the right faded edge. The strength is a value between 0.0 (no fade) and 1.0 (full fade). The default implementation returns 0.0 or 1.0 but no value in between. Subclasses should override this method to provide a smoother fade transition when scrolling occurs.
getRightPaddingOffsetAdded in API level 2 protected int getRightPaddingOffset () Amount by which to extend the right fading region. Called only when
getTopPaddingOffsetAdded in API level 2 protected int getTopPaddingOffset () Amount by which to extend the top fading region. Called only when
isPaddingOffsetRequiredAdded in API level 2 protected boolean isPaddingOffsetRequired () If the View draws content inside its padding and enables fading edges, it needs to support padding offsets. Padding offsets are added to the fading edges to extend the length of the fade so that it covers pixels drawn inside the padding. Subclasses of this class should override this method if they need to draw content inside the padding.
onAttachedToWindowAdded in API level 1 protected void onAttachedToWindow () This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onConfigurationChangedAdded in API level 8 protected void onConfigurationChanged (Configuration newConfig) Called
when the current configuration of the resources being used by the application have changed. You can use this to decide when to reload resources that can changed based on orientation and other configuration characteristics. You only need to use this if you are not relying on the normal
onCreateContextMenuAdded in API level 1 protected void onCreateContextMenu (ContextMenu menu) Views should implement this if the view itself is going to add items to the context menu.
onCreateDrawableStateAdded in API level 1 protected int[] onCreateDrawableState (int extraSpace) Generate the new
onDrawAdded in API level 1 protected void onDraw (Canvas canvas) Implement this to do your drawing.
onFocusChangedAdded in API level 1 protected void onFocusChanged (boolean focused, int direction, Rect previouslyFocusedRect) Called by the view system when the focus state of this view changes. When the focus change event is caused by directional navigation, direction and previouslyFocusedRect provide
insight into where the focus is coming from. When overriding, be sure to call up through to the super class so that the standard focus handling will occur.
onLayoutAdded in API level 1 protected void onLayout (boolean changed, int left, int top, int right, int bottom) Called from layout when this view should assign a size and position to each of its children. Derived classes with children should override this method and call layout on each of their children.
onMeasureAdded in API level 1 protected void onMeasure (int widthMeasureSpec, int heightMeasureSpec) Measure the view and its content to determine the measured width and the measured height. This method is invoked by CONTRACT: When overriding this method, you must call The base class implementation of measure defaults to the background size, unless a larger size is allowed by the MeasureSpec. Subclasses should override If
this method is overridden, it is the subclass's responsibility to make sure the measured height and width are at least the view's minimum height and width (
onScrollChangedAdded in API level 1 protected void onScrollChanged (int horiz, int vert, int oldHoriz, int oldVert) This is called in response to an internal scroll in this view (i.e., the view scrolled its own contents). This is typically as a result of
onSelectionChangedAdded in API level 3 protected void onSelectionChanged (int selStart, int selEnd) This method is called when the selection has changed, in case any subclasses would like to know. Note: Always call the super implementation, which informs the accessibility subsystem about the selection change. If you override this method you must call through to the superclass implementation.
onTextChangedAdded in API level 1 protected void onTextChanged (CharSequence text, int start, int lengthBefore, int lengthAfter) This method is called when the text is changed, in case any subclasses would like to know. Within
onVisibilityChangedAdded in API level 8 protected void onVisibilityChanged (View changedView, int visibility) Called when the visibility of the view or an ancestor of the view has changed.
setFrameAdded in API level 1 protected boolean setFrame (int l, int t, int r, int b)
verifyDrawableAdded in API level 1 protected boolean verifyDrawable (Drawable who) If your view subclass is displaying its own Drawable objects, it should override this function and return true for any Drawable it is displaying. This allows animations for those drawables to be scheduled. Be sure to call through to the super class when overriding this function.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates. Last updated 2022-09-08 UTC. [{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Missing the information I need" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Too complicated / too many steps" },{ "type": "thumb-down", "id": "outOfDate", "label":"Out of date" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Other" }] [{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Easy to understand" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Solved my problem" },{ "type": "thumb-up", "id": "otherUp", "label":"Other" }] What includes firm infrastructure Human resource management technology development and procurement?The support activities include a firm's infrastructure, human resource management, technology development, and procurement. The primary activities include inbound logistics, operations, outbound logistics, marketing and sales, and customer service.
What views a firm as a series of business processes that each add value to the product or service?The value chain model views the firm as a series or chain of basic activities that add a margin of value to a firm's products or services. These activities can be categorized as either primary activities or support activities.
Which company is using a broad market and low cost strategy?Broad cost leadership strategy: Companies target a broad market by offering products at prices below their competitors. Amazon is a good example of this strategy. The company eliminates every non-essential that might potentially increase the cost of production so it can offer lower prices.
What is high when it is easy for new competitors to enter a market and low when there are significant entry barriers to joining a market?Threat of new entrants is high when it is easy for new competitors to enter a market and low when there are are significant entry barriers to entering a market. Rivalry among existing competitors is high when competition is fierce in a market and low when competition is more complacent.
|