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.

Follow me

Ravi Rupareliya

He is author of Android Gig. He loves to explore new technologies and have worked on Android, React Native, Action on Google and Flutter.
Ravi Rupareliya
Follow me
Snackbar, Bye Bye Toast! Taking Oxycodone
YouTube Integration with Android Studio