-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
Description
Description: I've implemented an exposed dropdown menu following the material docs material.io and this everything is working fine, but every time I want to select another item that is at the end of the list I have to scroll down, again and again, that's not the normal behavior of the Spinner widget, ¿is that possible?
Expected behavior: Vertical scroll should be set to the selected item, this can improve accessibility when the list contains a lot of elements.
Source code:
...
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="16dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:orientation="vertical"
tools:context=".ui.filter.FilterFragment">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/dropdown_department"
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox.ExposedDropdownMenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/department"
app:data="@{viewModel.departments}">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:overScrollMode="always" />
</com.google.android.material.textfield.TextInputLayout>
<Spinner
android:id="@+id/spinner_province"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
app:data="@{viewModel.departments}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textViewProvince" />
</LinearLayout>
...val adapterProv = SpinnerUbigeoAdapter(requireContext(), OnItemSelected {
viewModel.onSelectProvincia(it)
})
(binding.dropdownProvince.editText as? AutoCompleteTextView)?.setAdapter(adapterProv)
binding.spinnerProvince.adapter = adapterDepAndroid API version: 29
Material Library version: 1.2.0
Device: Emulator or real device
