Android 12 Developer Preview is here! Try it out, and give us your feedback!

TextInputEditText

public class TextInputEditText
extends AppCompatEditText

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.TextView
       ↳ android.widget.EditText
         ↳ androidx.appcompat.widget.AppCompatEditText
           ↳ com.google.android.material.textfield.TextInputEditText


A special sub-class of EditText designed for use as a child of TextInputLayout.

Using this class allows us to display a hint in the IME when in 'extract' mode and provides accessibility support for TextInputLayout.

Summary

Inherited constants

Inherited fields

Public constructors

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

Public methods

void getFocusedRect(Rect r)
boolean getGlobalVisibleRect(Rect r, Point globalOffset)
CharSequence getHint()
boolean isTextInputLayoutFocusedRectEnabled()

Whether the edit text is using the TextInputLayout's focused rectangle.

InputConnection onCreateInputConnection(EditorInfo outAttrs)
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
boolean requestRectangleOnScreen(Rect rectangle)
void setTextInputLayoutFocusedRectEnabled(boolean textInputLayoutFocusedRectEnabled)

Whether the edit text should use the TextInputLayout's focused rectangle.

Protected methods

void onAttachedToWindow()

Inherited methods

Public constructors

TextInputEditText

public TextInputEditText (Context context)

Parameters
context Context

TextInputEditText

public TextInputEditText (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

TextInputEditText

public TextInputEditText (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context

attrs AttributeSet

defStyleAttr int

Public methods

getFocusedRect

public void getFocusedRect (Rect r)

Parameters
r Rect

getGlobalVisibleRect

public boolean getGlobalVisibleRect (Rect r, 
                Point globalOffset)

Parameters
r Rect

globalOffset Point

Returns
boolean

getHint

public CharSequence getHint ()

Returns
CharSequence

isTextInputLayoutFocusedRectEnabled

public boolean isTextInputLayoutFocusedRectEnabled ()

Whether the edit text is using the TextInputLayout's focused rectangle.

Returns
boolean

onCreateInputConnection

public InputConnection onCreateInputConnection (EditorInfo outAttrs)

Parameters
outAttrs EditorInfo

Returns
InputConnection

onInitializeAccessibilityNodeInfo

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

Parameters
info AccessibilityNodeInfo

requestRectangleOnScreen

public boolean requestRectangleOnScreen (Rect rectangle)

Parameters
rectangle Rect

Returns
boolean

setTextInputLayoutFocusedRectEnabled

public void setTextInputLayoutFocusedRectEnabled (boolean textInputLayoutFocusedRectEnabled)

Whether the edit text should use the TextInputLayout's focused rectangle.

Parameters
textInputLayoutFocusedRectEnabled boolean

Protected methods

onAttachedToWindow

protected void onAttachedToWindow ()