Android Floating Labels for EditText Using Design Support Library

Google has introduced a new support library called android design support library. This library includes several new components including navigation drawer view, floating action button, snackbar, tabs, floating labels for edit text, etc. In this example, I will show you to implement android floating labels for EditText using design support library.

Floating Action Button (FAB) Using Android Design Support Library
How to Add Ripple Effect/Animation to a Android Button
Android Navigation Drawer View: Material Design Support Library

Create a new Android Project

Now, we’ll create a new a new android project to implement floating labels for edit text in android application using design support library. Create a new android project with following information.

Application Name: Floating Labels for EditText
Company Domain: viralandroid.com
Package Name: com.viralandroid.floatinglabelsforedittext
Minimum SDK: Android 2.2 (API 8 Froyo)

Floating Labels for EditText Demo

Adding Dependency

Add android design support library dependency in your build.gradle file.
build.gradle file:

Adding EditText and TextInputLayout

Open your xml layout file and add below code.

Strings.xml File:

Add following string values to your strings.xml file.

And following is the default code ofactivity file.

That’s all.
UI 5960060518330729098
Home item