Google Material Design - Xamarin.Android Text Field.
This is a ported build, converted from Java to C# for use with the Xamarin MonoFramework. There are only minor additions to the original library, these include the removal of various deprecated dependancies.
Simply add the following Nuget Package to your Xamarin.Android App, and ensure you have the latest AndroidX dependancies installed, if you don't the code will tell you which ones are missing.
- Install using Package Manager:
Install-Package Xama.JTPorts.MaterialTextField -Version 1.0.2
- Install .NET CLI:
dotnet add package Xama.JTPorts.MaterialTextField --version 1.0.2
Create the control inside of your layout and wrap it around a single EditText control.
<Xama.JTPorts.MaterialTextField.MaterialTextField
android:id="@+id/mtvInput"
android:layout_marginTop="15dp"
android:layout_width="300dp"
android:layout_height="wrap_content"
app:mtf_labelColor="@android:color/white"
app:mtf_image="@drawable/iconemail">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email Address"
android:inputType="textEmailAddress"
android:textColor="@android:color/black"
android:textSize="15sp" />
</Xama.JTPorts.MaterialTextField.MaterialTextField>
You can supply the following attributes:
<attr name="mtf_cardCollapsedHeight" format="dimension"/>
<attr name="mtf_labelColor" format="color"/>
<attr name="mtf_image" format="reference"/>
<attr name="mtf_hasFocus" format="boolean"/>
<attr name="mtf_animationDuration" format="integer"/>
<attr name="mtf_openKeyboardOnFocus" format="boolean"/>
<attr name="mtf_backgroundColor" format="color"/>
These mostly have default values should you decide not to supply them
If you want to support the work that I do and you find any of these libraries useful? Consider supporting it by joining stargazers for this repository. 🔭 🌠
or alternatively if you want to you can also buy me a coffee.
You know, only if you want to.