android – Activity won't scroll past Exposed Dropdown Menu with focus-ThrowExceptions

Exception or error:

I am trying to implement an Exposed Dropdown Menu in Android as an alternative to the good old Spinner. I’m following the guidance for Android in here.

Whilst the Dropdown Menu itself is functioning OK, I’m running into the following problem.

When I open the dropdown menu and then close it down again (whether by selecting an item or just clicking on the dropdown arrow again), the UI element clearly still has focus because it has an accented line under it (see below).

But then I find that I cannot scroll my Activity view beyond the dropdown that has focus… it just acts as a block. It doesn’t scroll any further up than the following:

enter image description here

When the dropdown loses focus, the view can again scroll past the dropdown.

I’m placing the dropdown using the XML layout from the guidance:

<com.google.android.material.textfield.TextInputLayout
    style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/hint_text">

  <AutoCompleteTextView
      android:id="@+id/filled_exposed_dropdown"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/>

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

Any ideas?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *