Floting Labels : Text Input Layout

We have already covered FloatingActionButton and SnackBar from Material Design. Today we will discuss about TextInputLayout.

There is a nice and interesting approach to customize edittext in Material Design. They didn’t touch EditText directly, instead TextInputLayout will be used to enhance its functionality.

We have seen lot of libraries for floating labels but in Material Design we can directly use it with the help of TextInputLayout.

Add design support library in gradle file.

Add TextInputLayout in your xml :

TextInputLayout will take value of android:hint from EditText and display it as floating label.

TIL1

You can also set error message by using setErrorEnabled() and setError() methods.

Snackbar, Bye Bye Toast!
YouTube Integration with Android Studio