RecyclerView中的滚动条颜色 [英] Scrollbar color in RecyclerView
本文介绍了RecyclerView中的滚动条颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在recyclerView中更改滚动条的颜色?
How can I change the color of my scrollbar in a recyclerView?
我有滚动条,但我想更改其颜色. 我的recyclerView是这样的:
I have the scrollbar but I want to change its color. My recyclerView is like this:
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/recyclerView"
android:layout_below="@id/my_toolbar"
android:layout_above="@+id/progressBar"
android:scrollbars="vertical"
/>
推荐答案
您可以通过在Recyclerview中包含以下代码行来实现此目的
You can do this by including following line of code in your Recyclerview
android:scrollbarThumbVertical="@drawable/yoursdrawablefile
在我的情况下,可绘制文件为:
The drawable file in my case is:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:startColor="#000" android:endColor="#000"
android:angle="45"/>
<corners android:radius="6dp" />
</shape>
这篇关于RecyclerView中的滚动条颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文