0

I have TextInputLayout that contains AutoCompleteTextView. I want this layout to have a drop-down menu, so I put endIconMode="dropdown_menu". The problem is that I can't hide the underline. I tried to use backgroundTint or boxStrokeColor and make them null, but it didn't work. I need the editText looks the same as this image without the underline.

Here is my XML code

 <com.google.android.material.textfield.TextInputLayout
                android:id="@+id/courseCodeLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginStart="20dp"
                android:layout_marginTop="20dp"
                android:layout_marginEnd="20dp"
                app:boxBackgroundMode="filled"
                app:endIconMode="dropdown_menu">
                <AutoCompleteTextView
                    android:id="@+id/courseCode"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@drawable/set_info_bg"
                    android:fontFamily="@font/poppins"
                    android:hint="Course Code"
                    android:focusable="false"
                    android:padding="15dp"
                    android:textSize="15sp" />
            </com.google.android.material.textfield.TextInputLayout>
Omar
  • 37
  • 5
  • Does this answer your question? [Remove underline from TextInputEditText](https://stackoverflow.com/questions/57063519/remove-underline-from-textinputedittext) – ihaydinn Apr 04 '20 at 21:24

1 Answers1

3

For your needs, I think a good way is to make some edits in styles.xml file.

Here is what should work for you:

<style name="Theme.MyApp" parent="Theme.MaterialComponents.Light.NoActionBar">
    <item name="textInputStyle">@style/Widget.MyApp.TextInputLayout</item>
</style>

<style name="Widget.MyApp.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.FilledBox">
    <item name="boxStrokeWidth">0dp</item>
    <item name="boxStrokeWidthFocused">0dp</item>
</style>

Let me know if that works !!

clauub
  • 1,134
  • 9
  • 19