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

q126y
  • 1,589
  • 4
  • 18
  • 50

3 Answers3

14

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!

Evan
  • 214
  • 3
  • 8
1

You have one of two oportunities:

1) Change drawable of scrollbar through android:scrollbarThumbVertical="@drawable/yoursdrawablefile

2) Work with scrollbar programmatically through onDrawHorizontalScrollBar and onDrawVerticalScrollBar callbacks.

Please, first two answers of this question for more details.

Community
  • 1
  • 1
Michael Spitsin
  • 2,539
  • 2
  • 19
  • 29
-1
  1. Horizontal RecyclerView

    android:scrollbars="horizontal"
    android:scrollbarThumbHorizontal="@color/horizontal_color"
    android:scrollbarSize="1dp"
    
  2. Vertical RecyclerView ( default android:scrollbars="vertical")

    android:scrollbarThumbHorizontal="@color/vertical_color"
    android:scrollbarSize="1dp"
    
Pang
  • 9,564
  • 146
  • 81
  • 122
Farid Haq
  • 3,728
  • 1
  • 21
  • 15