Android Tutorial 1: Google Material Design Floating Labels for EditText

Тәжірибелік нұсқаулар және стиль

Google Material Design Floating Labels for EditText
#Tutorial 1
EditText has an attribute called "hint". Typically hint was intended to give its user an idea about what he has to enter in the field. Floating labels works on API Level 21+.
Android floating labels were introduced in android design support library to display a floating label over EditText. Initially it gives hint in EditText when the field is empty. When user start inputting the text, it starts animating by moving to floating label position.
Can also be used to give error when the data in the fields is not valid.
Using setErrorEnabled() and setError() methods, we enable and display error at the bottom of the EditText.
Have implemented TextWatcher interface to keep a watch on the data as it is entered and check for its validity.
For email validation, have used Pattern class from Java.Util package to make sure that the entered email matches with the regular expression of an Email.
Check out the code on this GITHUB repo:
github.com/ssrishabh96/-Mater...
Feel free to ask any query and doubts.

Пікірлер: 1

  • @jhonreyjusto4885
    @jhonreyjusto48856 жыл бұрын

    you have maven repo?

Келесі