0

I'm looking to change the style of the scrollbar in my spinner popup view. But changing properties in the xml doesn't do anything to the popup as it's a different view.

enter image description here

<Spinner
        android:id="@+id/countrySpinner"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@drawable/spinner_background"
        android:layoutDirection="rtl"
        android:popupBackground="@drawable/spinner_dropdown_background"
        android:popupElevation="4dp"
        app:popupTheme="@style/PopupTheme"
        app:layout_constraintBottom_toTopOf="@id/citySpinner"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintWidth_percent="0.8" />

This is the style of my spinner. As it's clear, the scrollbar is appearing on top of the corners of the spinner which make it look very off.

Is there anyway to change the style of the scrollbar? Make it more round like the corners. Or at least remove it entirely.

Edit : I managed to remove it from styles. Would still like if there was a way to customize it

Ahmad Sattout
  • 2,248
  • 1
  • 19
  • 42

1 Answers1

0

Spinner does not have a scrollbar.The popup shown by spinner has a scrollbar. So you need to change the properties of the ListView shown by spinner. But ListView itself is not exposed by Spinner by any public methods.

But If you are going to create a custom Spinner, i believe it is easier to implement the whole popup to suit your needs than using reflection.

check this link for more explanation

ismail alaoui
  • 5,748
  • 2
  • 21
  • 38