6
    <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"/>

我正在 5.1.1 上测试代码。改变android:scrollbarSize没有效果。我尝试增加和减少它,没有变化。

如何改变宽度?

4

3 回答 3

13

现在,我告诉你一个方法,你可以尝试一下,然后你就会知道答案:添加以下代码:

android:scrollbarThumbVertical="@color/colorAccent"

整个区块是这样的:

 <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"/>

现在,你会发现你android:scrollbarSize有效果。祝你好运!

于 2016-10-13T15:53:11.277 回答
1

你有两个机会之一:

1)通过改变滚动条的drawableandroid:scrollbarThumbVertical="@drawable/yoursdrawablefile

onDrawHorizontalScrollBar2)通过和onDrawVerticalScrollBar回调以编程方式使用滚动条。

请先回答这个问题的前两个答案以获取更多详细信息。

于 2016-07-20T18:25:36.753 回答
-1
  1. 水平回收器视图

    android:scrollbars="horizontal"
    android:scrollbarThumbHorizontal="@color/horizontal_color"
    android:scrollbarSize="1dp"
    
  2. 垂直 RecyclerView ( 默认 android:scrollbars="vertical")

    android:scrollbarThumbHorizontal="@color/vertical_color"
    android:scrollbarSize="1dp"
    
于 2018-09-27T07:55:54.313 回答