androidscrollbarandroid-spinnerandroid-scrollbar

Android How to change scrollbar color in Spinner


How can I change the default color of scrollbar present in the spinner? is it possible to do it on an app level?

<Spinner
        android:id="@+id/location"
        style="@style/Widget.AppCompat.Spinner.Underlined"
        android:layout_width="0dp"
        android:layout_height="45dp"
        android:backgroundTint="@color/input_borde"/>

Solution

  • You can with android:scrollbarThumbVertical="@drawable/youdrawable

    For example:

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android">
    
        <gradient android:startColor="#66C0C0C0" android:endColor="#66C0C0C0"
            android:angle="45"/>
        <corners android:radius="6dp" />
    
    </shape>
    

    Spinners in Android doesn't have a Scrollbar, the scrollbar exists within the listView maintained inside the Spinner, and has no public access.

    There's a run-time way to override it in the link below

    Resource: URL

    Custom spinner: URL