我试图在react-native中更改ScrollView滚动指示器的颜色。
如果我使用这个prop
在Android上,我会收到一条错误消息,即indicatorStyle不是有效的属性。
现在这并不令人惊讶,因为它在文档中进行了描述,仅在iOS上受支持。

现在的问题是,有没有办法在Android上更改指示器的颜色?

最佳答案

创建一个xml滚动条

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


<gradient
      android:angle="45"
      android:endColor="#FF3401"
      android:centerColor="#ff5c33"
      android:startColor="#FF3401" />
      <corners android:radius="8dp" />

</shape>

并像这样添加滚动条
android:scrollbarThumbVertical="@drawable/scrollbar

关于android - 更改ScrollView指示器的颜色,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54752669/

10-12 13:01
查看更多