androidxmlkotlinautocompletetextviewtextinputlayout

TextInputLayout label overlapping AppCompatAutoCompleteTextView input


I'm having an issue where my TextInputLayout label is being overlapped by the input within an AppCompatAutoCompleteTextView. My apologies if this has been answered before. Here is my code snippet:

<com.google.android.material.textfield.TextInputLayout
                android:id="@+id/commission_form_category_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content">

<androidx.appcompat.widget.AppCompatAutoCompleteTextView
                    android:id="@+id/commission_form_category_input"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="@string/commission_form_category_label_text"
                    android:paddingHorizontal="16dp"
                    android:paddingVertical="16dp"
                    android:text="Hello"
                    android:singleLine="true"
                    android:textSize="16sp" />

</com.google.android.material.textfield.TextInputLayout>

Here is what it looks like: overlapping text


Solution

  • Try this-

     <com.google.android.material.textfield.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Example">
    
            <androidx.appcompat.widget.AppCompatAutoCompleteTextView
                style="@style/Widget.MaterialComponents.AutoCompleteTextView.FilledBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Hello" />
        </com.google.android.material.textfield.TextInputLayout>