Difference between TextInputLayout and TextInputEditText

Dwivedi Ji picture Dwivedi Ji · Jun 15, 2016 · Viewed 24.4k times · Source

Need to know what actually difference between TextInputEditText and TextInputLayout, When should we use one of them.

Answer

Budius picture Budius · Jun 15, 2016

They are different layouts that complement each other functionalities.

  • TextInputLayout extends LinearLayout
  • TextInputEditText extends EditText

They were meant to be used together like following:

<TextInputLayout>
   <TextInputEditText/>
</TextInputLayout>

It's all there on the official docs:

TextInputLayout:

https://developer.android.com/reference/android/support/design/widget/TextInputLayout.html

Layout which wraps an EditText (or descendant) to show a floating label when the hint is hidden due to the user inputting text

TextInputEditText:

https://developer.android.com/reference/android/support/design/widget/TextInputEditText.html

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