public class AppCompatEditText
extends EditText implements TintableBackgroundView, OnReceiveContentViewBehavior, EmojiCompatConfigurationView

   ↳ 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 ViewCompat.
  • Allows setting of the background tint using R.attr.backgroundTint and R.attr.backgroundTintMode.
  • Allows setting a custom listener to handle insertion of content (e.g. pasting text or an image from the clipboard). This listener provides the opportunity to implement app-specific handling such as creating an attachment when an image is pasted.

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.


Inherited constants

Inherited fields

Public constructors

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

Public methods

ActionMode.Callback getCustomSelectionActionModeCallback()
Editable getText()

Return the text that the view is displaying.

TextClassifier getTextClassifier()

Returns the TextClassifier used by this TextView.

boolean isEmojiCompatEnabled()
InputConnection onCreateInputConnection(EditorInfo outAttrs)

If a listener is set, the returned InputConnection will use it to handle calls to InputConnection.commitContent(InputContentInfo, int, Bundle).

boolean onDragEvent(DragEvent event)
ContentInfoCompat onReceiveContent(ContentInfoCompat payload)

Implements the default behavior for receiving content, which coerces all content to text and inserts into the view.

boolean onTextContextMenuItem(int id)

If a listener is set, uses it to execute the "Paste" and "Paste as plain text" menu actions.

void setBackgroundDrawable(