'Text Input layout hint is overlapped with the outlined box
my text input layout's hint text seems overlapped
how can I move the hint text to little right of the outline.
my xml :
<com.google.android.material.textfield.TextInputLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/tilAddress"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:padding="5dp"
app:hintAnimationEnabled="true"
app:hintTextColor="@color/colorPrimaryDark"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvBillingText">
<EditText
android:id="@+id/tilAddress1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:hint="Address1 *"
android:background="@null"
android:padding="12dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvBillingText"/>
</com.google.android.material.textfield.TextInputLayout>`
any hep is appreciated . thanks
Edit
By removing the margin , i could fix the issue
Solution 1:[1]
I removed the layout_margin from Edittext and it could solve my issue
Solution 2:[2]
Have you tried setting the hint on the TextInputLayout
instead of the EditText? I think it's also recommended to replace the EditText
with a TextInputEditText
like in the following example:
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/form_username">
<com.google.android.material.textfield.TextInputEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Liya |
Solution 2 | Luciano |