问题
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?
回答3:
You can change the style of spinner to change the spinner color.
Make a style in style.xml like below:
<style name="App_SpinnerStyle" >
<item name="android:scrollbarThumbVertical">@color/colorAccent</item>
</style>
then in xml of spinner :
android:popupTheme="@style/App_SpinnerStyle"
Tried and tested!!
来源:https://stackoverflow.com/questions/37163122/android-change-color-of-spinners-popup-scrollbar