I am working on login screen where I want to implememt material edit text with following view :
Following is my code :
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
style="@style/ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="This is Hint"/>
</com.google.android.material.textfield.TextInputLayout>
But OutlinedBox is not appearing. This is how it looks :
PLease help.
The primary use of a TextInputLayout is to act as a wrapper for EditText(or its descendant) and enable floating hint animations. Rule of Thumb : TextInputLayout should wrap TextInputEditText instead of the normal EditText.
Use this
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
Instead pf this
style="@style/ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox"
SAMPLE CODE
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="This is Hint"/>
</com.google.android.material.textfield.TextInputLayout>
OUTPUT
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With