Today, I’m talking about EditText Floating Labels in Android application.

The new TextInputLayout allows us to wrap EditText views in order to display floating labels above the EditText field. This layout also let show error messages below the EditText field. When an EditText has focus, the assigned hint will ‘float’ above the view to the top-left hand side.

Firstly need to add library or add a dependency to gradle file.
[xml]
dependencies {
compile ‘com.android.support:design:22.2.0’
}
[/xml]

After it need to update the strings.xml file in the project.
[xml]

EditText Floating Labels Demo
Username
Password
Sign In
Username can not be empty

[/xml]

Next step is updating layout for the project.
[xml]

9 CommentsClose Comments

9 Comments

  • Meynard
    Posted July 28, 2015 at 5:58 am 0Likes

    Does this support lower versions of Android such as Kitkat and JellyBean? Thanks

    • Posted July 29, 2015 at 8:38 pm 0Likes

      Yes, it supports all versions start from Froyo(API 8)

      • Meynard
        Posted September 4, 2015 at 6:26 am 0Likes

        I see. Thanks!

  • candy
    Posted September 28, 2015 at 5:40 am 0Likes

    thank you

  • narender
    Posted August 30, 2016 at 4:05 pm 0Likes

    Does it supports in eclipse

    • Posted September 18, 2016 at 3:02 pm 0Likes

      Of course, if you add this library to eclipse it will work without any problem

      • narender balla
        Posted September 24, 2016 at 4:07 am 0Likes

        How to add this library to eclipse can u please help me

        • Posted September 27, 2016 at 7:20 pm 0Likes

          Hi,

          first of all you should install or update “Android Support Library” and “Android Support Repository” and after it you can find “*.aar” libraries in the {ANDROID_SDK}/extras/android/m2repository /com/android/support/design folder

  • Trackback: Всплывающие подсказки для EditText: фичи Design Support Library | Java-Help

Leave a comment

Newsletter Subscribe

Get the Latest Posts & Articles in Your Email

We Promise Not to Send Spam:)