AppCompatTextView

public class AppCompatTextView
extends TextView implements TintableBackgroundView, TintableCompoundDrawablesView

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ androidx.appcompat.widget.AppCompatTextView


A TextView which supports compatible features on older versions of the platform, including:

This will automatically be used when you use TextView in your layouts and the top-level activity / dialog is provided by appcompat. You should only need to manually use this class when writing custom views.

Summary

Inherited constants

Inherited fields

Public constructors

AppCompatTextView(Context context)
AppCompatTextView(Context context, AttributeSet attrs)
AppCompatTextView(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

int getFirstBaselineToTopHeight()
int getLastBaselineToBottomHeight()
CharSequence getText()
TextClassifier getTextClassifier()

Returns the TextClassifier used by this TextView.

PrecomputedTextCompat.Params getTextMetricsParamsCompat()

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

InputConnection onCreateInputConnection(EditorInfo outAttrs)
void setBackgroundDrawable(Drawable background)
void setBackgroundResource(int resId)
void setCompoundDrawables(Drawable left, Drawable top, Drawable right, Drawable bottom)
void setCompoundDrawablesRelative(Drawable start, Drawable top, Drawable end, Drawable bottom)
void setCompoundDrawablesRelativeWithIntrinsicBounds(int start, int top, int end, int bottom)
void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start, Drawable top, Drawable end, Drawable bottom)
void setCompoundDrawablesWithIntrinsicBounds(int left, int top, int right, int bottom)
void setCompoundDrawablesWithIntrinsicBounds(Drawable left, Drawable top, Drawable right, Drawable bottom)
void setCustomSelectionActionModeCallback(ActionMode.Callback actionModeCallback)

See TextViewCompat.setCustomSelectionActionModeCallback(TextView, ActionMode.Callback)

void setFirstBaselineToTopHeight(int firstBaselineToTopHeight)
void setLastBaselineToBottomHeight(int lastBaselineToBottomHeight)
void setLineHeight(int lineHeight)
void setPrecomputedText(PrecomputedTextCompat precomputed)

Sets the PrecomputedTextCompat to the TextView.

void setTextAppearance(Context context, int resId)
void setTextClassifier(TextClassifier textClassifier)

Sets the TextClassifier for this TextView.

void setTextFuture(Future<PrecomputedTextCompat> future)

Set the precomputed text future.

void setTextMetricsParamsCompat(PrecomputedTextCompat.Params params)

Apply the text layout parameter.

void setTextSize(int unit, float size)
void setTypeface(Typeface tf, int style)

Protected methods

void drawableStateChanged()
void onLayout(boolean changed, int left, int top, int right, int bottom)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter)

Inherited methods