Skip to content

MrEngineer13/FloatingLabelLayout

Repository files navigation

Floating Label Edit Text Pattern for Android

Status

No longer activly maintained due to a plethora of floating label libraries.

Features

  1. Ability to edit EditText/FloatingLabelLayout in the layout
  2. Can handle orientation changes
  3. Customize view styling
  4. Two triggers, one based on focus and the other based on the input
  5. Backwards compatible to 2.3.x

Float label design pattern

Usage

  1. Add floatinglabel module as a dependency to your project

2a. Either add the following to your xml:

    <com.mrengineer13.fll.FloatingLabelEditText
        xmlns:fll="http://schemas.android.com/apk/res-auto"
        android:id="@+id/fll_username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        fll:floatLabelTrigger="text"
        fll:floatLabelTextAppearance="@style/TextAppearance.FLL.FloatLabel">

        <EditText
            android:id="@+id/edit_username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/account_username_hint"
            android:singleLine="true"
            android:inputType="textNoSuggestions"
            android:imeOptions="actionNext"
            android:nextFocusDown="@+id/edit_password" />

    </com.mrengineer13.fll.FloatingLabelEditText>

2b. or if you want to create one programmatically then use

 FloatingLabelEditText floatingLabelEditText = new FloatingLabelEditText(Activity.this);

Known Bugs

1. onFocusChangeListener bug

As of v0.1 this library uses onFocusChangeListener so @Overriding it for the EditText will not work. Try add a TextWatcher instead.

Credit:

  1. Matt Smith and Google for the idea
  2. Chris Banes for his implementation

About

Foating Label design pattern for Android

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages