Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change RecyclerView scrollBar width

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ddd"
        android:fadeScrollbars="true"
        android:scrollbarSize="12dp"
        android:orientation="vertical"
        android:scrollbars="vertical"/>

I am testing the code on 5.1.1. Changing android:scrollbarSize has no effect. I tried increasing and decreasing it, no change.

How to change the width?

like image 588
q126y Avatar asked Jul 20 '16 18:07

q126y


1 Answers

Now, I tell you a method,you can try it and then you will know the answer: add the following codes:

android:scrollbarThumbVertical="@color/colorAccent"

the whole block like this:

 <android.support.v7.widget.RecyclerView
    android:id="@+id/RV_hot_latest"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:scrollbars="vertical"
    android:scrollbarThumbVertical="@color/colorAccent"
    android:scrollbarSize="18dp"
    android:scrollbarStyle="outsideInset"/>

Now ,you will find you android:scrollbarSize has effect. Good luck!

like image 156
Evan Avatar answered Sep 22 '22 02:09

Evan