Does API 21 provide a method to use the following feature:
http://www.google.com/design/spec/components/text-fields.html#text-fields-floating-labels
I'm trying to float the EditText hints.
Thanks!
Floating Labels: Floating labels first introduced in Android design support library to display floating label over EditText. Firstly it acts as hint in the EditText when the field is empty. After that when a user start inputting the text it starts animating by moving to floating label position.
Android App Development for Beginners Before getting into example, we should know what is TextInputLayout in android. TextInputLayout is extended by Linear Layout. It going to act as a wrapper for edit text and shows flatting hint animation for edit text.
Floating hint EditText:
Add below dependency in gradle:
compile 'com.android.support:design:22.2.0'
In layout:
<android.support.design.widget.TextInputLayout android:id="@+id/text_input_layout" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/editText" android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="UserName"/> </android.support.design.widget.TextInputLayout>
Yes, as of May 29, 2015 this functionality is now provided in the Android Design Support Library
This library includes support for
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With