Android: change color of spinner's popup scrollbar

喜欢而已 提交于 2020-01-16 04:14:25

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!