Android TextInputLayout

January 13, 2018 Oclemy Android EditText 0 minutes, 29 seconds

This layout wraps android.widget.EditText to show a floating label when the hint is hidden due to the user inputting text.

This layout is normally used with

Some of the unique features it supports include:

  • Enabling and Setting Errors via setErrorEnable(boolean) and setError(CharSequence).
  • Character counter via setCounterEnabled(boolean).

This class resides in the package.


TextInputEditText inherits from LinearLayout:

public class TextInputLayout extends LinearLayout {}

TextInputLayout can only contain one EditText. Attempt to add more than one will result to java.lang.IllegalArgumentException.