Install MaterialTextField via Gradle
masterTo use MaterialTextField in your Android project, add the following dependency to your module's build.gradle file:
implementation 'com.github.florent37:materialtextfield:1.0.7'repository·master·Indexed 23 days ago
https://github.com/florent37/materialtextfieldAn Android library providing a visually enhanced 'Floating Edit Text' component based on Material Design principles. Includes documentation on Gradle installation, XML layout implementation, and configuration attributes such as mtf_image, mtf_labelColor, and mtf_animationDuration.
To use MaterialTextField in your Android project, add the following dependency to your module's build.gradle file:
implementation 'com.github.florent37:materialtextfield:1.0.7'To implement the floating edit text effect, wrap a standard EditText inside a com.github.florent37.materialtextfield.MaterialTextField component.
Note: You must provide a drawable to the app:mtf_image attribute for the component to function correctly.
<com.github.florent37.materialtextfield.MaterialTextField
android:layout_width="300dp"
android:layout_height="wrap_content"
app:mtf_labelColor="#666"
app:mtf_image="@drawable/ic_mail_grey600_24dp"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:textColor="#333"
android:textSize="15sp" />
</com.github.florent37.materialtextfield.MaterialTextField>The following attributes are available for configuring the MaterialTextField component:
| Attribute | Description |
|---|---|
app:mtf_cardCollapsedHeight | Sets the height of the card when it is in a collapsed state. |
app:mtf_image | A drawable resource to be displayed as an icon. |
app:mtf_animationDuration | The duration of the animations (in milliseconds). |
app:mtf_labelColor | The color of the floating label. |
app:mtf_openKeyboardOnFocus | Boolean determining if the keyboard should open when the field is focused. |
app:mtf_hasFocus | Boolean to manually set the focus state (added in v1.0.6). |