I am using textInputLayout in my application, but I am getting additional padding to the Hint. Can anyone help me out.
Xml Code:
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:id="@+id/outlined_member_name_text_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:hint="@string/name"
app:startIconDrawable="@drawable/ic_baseline_person_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/select_contact_button">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/member_name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textCapSentences|text" />
</com.google.android.material.textfield.TextInputLayout>
You can add -ve padding to TextInputEditText, it should solve the extra padding issue that you have. For example I have used -10dp you can check what fits your case.
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:id="@+id/outlined_member_name_text_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:hint="@string/name"
app:startIconDrawable="@drawable/ic_baseline_person_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/select_contact_button">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/member_name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="-10dp"
android:inputType="textCapSentences|text" />
</com.google.android.material.textfield.TextInputLayout>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.