open class AppCompatEditText : EditText, TintableBackgroundView
   ↳ android.view.View
   ↳ android.widget.TextView
   ↳ android.widget.EditText
   ↳ androidx.appcompat.widget.AppCompatEditText

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

  • Allows dynamic tint of its background via the background tint methods in androidx.core.view.ViewCompat.
  • Allows setting of the background tint using R.attr#backgroundTint and R.attr#backgroundTintMode.

This will automatically be used when you use EditText 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.


Public constructors
<init>(context: Context!)

<init>(context: Context!, attrs: AttributeSet!)

<init>(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods
open Unit
setBackgroundResource(@DrawableRes resId: Int)

open Editable?

Return the text that the view is displaying.

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

open Unit

See TextViewCompat#setCustomSelectionActionModeCallback(TextView, ActionMode.Callback)

open Unit

open InputConnection!

open Unit
setTextClassifier(@Nullable textClassifier: TextClassifier?)

Sets the TextClassifier for this TextView.

open TextClassifier

Returns the TextClassifier used by this TextView.

Protected methods
open Unit

Public constructors


AppCompatEditText(context: Context!)


AppCompatEditText(context: Context!, attrs: AttributeSet!)


AppCompatEditText(context: Context!, attrs: AttributeSet!, defStyleAttr: Int)

Public methods


open fun setBackgroundResource(@DrawableRes resId: Int): Unit


@Nullable open fun getText(): Editable?

Return the text that the view is displaying. If an editable text has not been set yet, this will return null.


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


open fun setCustomSelectionActionModeCallback(actionModeCallback: Callback!): Unit

See TextViewCompat#setCustomSelectionActionModeCallback(TextView, ActionMode.Callback)


open fun setBackgroundDrawable(background: Drawable!): Unit


open fun onCreateInputConnection(outAttrs: EditorInfo!): InputConnection!


open fun setTextClassifier(@Nullable textClassifier: TextClassifier?): Unit

Sets the TextClassifier for this TextView.


@NonNull open fun getTextClassifier(): TextClassifier

Returns the TextClassifier used by this TextView. If no TextClassifier has been set, this TextView uses the default set by the android.view.textclassifier.TextClassificationManager.

Protected methods


protected open fun drawableStateChanged(): Unit