1

如何更改微调器中滚动条的默认颜色?是否可以在应用程序级别上做到这一点?

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

1 回答 1

1

你可以用android:scrollbarThumbVertical="@drawable/youdrawable

例如:

<?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>

Android 中的 Spinner 没有 Scrollbar,滚动条存在于 Spinner 内部维护的 listView 中,并且没有公共访问权限。

在下面的链接中有一种运行时方法可以覆盖它

资源: 网址

自定义微调器: URL

于 2019-01-24T08:59:08.267 回答