Android: change color of spinner's popup scrol

2019-07-27 03:54发布

问题:

How can I change the color of the spinner's popup scrollbar?

For some reason the color of the scrollbar is currently white on a white background, it is not visible.

回答1:

add android:scrollbarThumbVertical="@drawable/yourdawable //in your spinner 

yourdrawable.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

    <gradient android:startColor="your color" android:endColor="your color"
        android:angle="45"/>

    <corners android:radius="6dp" />

</shape>


回答2:

I found this solution for changing the scrollbar color globally:

How can I change the color of the scrollbar in Android?