I'm using Material theme and TextInputLayout for a login page. It's normal until I disable hint to remove floating hint. As you can see form the password field where hint is disabled, the look is weird, the stroke is gone.
Is it the default behavior?
<com.google.android.material.textfield.TextInputLayout
app:boxBackgroundColor="@android:color/white"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="12dp"
android:hint="Username">
<com.google.android.material.textfield.TextInputEditText
android:drawableStart="@drawable/ic_user"
android:drawablePadding="6dp"
android:focusedByDefault="false"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
app:boxBackgroundColor="@android:color/white"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:hintEnabled="false"
android:layout_marginStart="20dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="12dp"
android:hint="Password">
<com.google.android.material.textfield.TextInputEditText
android:drawableStart="@drawable/ic_lock"
android:drawablePadding="6dp"
android:maxLines="1"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
EDIT:
We have to include material design components in our build.gradle
, for example:
implementation 'com.google.android.material:material:1.1.0'
Even though we can use the widget and the default style without including the library, it seems that it might make some UI issues. Best to make make sure the library is included if we want to use material component.