AutoCompleteTextView only show one option after dark mode enable

210 Views Asked by At
<com.google.android.material.textfield.TextInputLayout
        android:id="@+id/input_layout"
        style="@style/Widget.Material3.TextInputLayout.OutlinedBox.ExposedDropdownMenu">

        <com.google.android.material.textfield.MaterialAutoCompleteTextView
            android:id="@+id/auto_complete_text_view"
            android:inputType="none"/>
    </com.google.android.material.textfield.TextInputLayout>
val items = arrayOf("A", "B", "C")
binding.autoCompleteTextView.setSimpleItems(items)

I hava an simple exposed dropdown menu like this.

When I select one of options, and then enable dark mode. It no longer works fine.
As the screenshot shows, I select "A", then enable dark mode. When I was opening the dropdown again to select another option there was only one option in the list ("A").

1

There are 1 best solutions below

2
user6925031 On

Set saveEnabled to "false" for the MaterialAutoCompleteTextView in XML

<com.google.android.material.textfield.MaterialAutoCompleteTextView
                android:id="@+id/auto_complete_text_view"
                android:inputType="none"
                android:saveEnabled="false" />