Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
更改Android RecyclerView中滚动条的位置_Android_Scrollbar_Android Recyclerview - Fatal编程技术网

更改Android RecyclerView中滚动条的位置

更改Android RecyclerView中滚动条的位置,android,scrollbar,android-recyclerview,Android,Scrollbar,Android Recyclerview,嘿,我想知道是否有可能改变Android RecyclerView中滚动条的位置。我想将滚动条移近显示屏的右侧。如果有人能给我指出一个正确的方向,我会非常感激,因为目前我在这方面找不到任何东西 谢谢 我只有一个解决办法 您只能在主内容布局中添加顶部和底部填充(或边距) 然后在不定义样式的情况下循环使用视图,如下所示: <android.support.v7.widget.RecyclerView android:id="@+id/cardList" android:layout

嘿,我想知道是否有可能改变Android RecyclerView中滚动条的位置。我想将滚动条移近显示屏的右侧。如果有人能给我指出一个正确的方向,我会非常感激,因为目前我在这方面找不到任何东西


谢谢

我只有一个解决办法

您只能在主内容布局中添加顶部和底部填充(或边距)


然后在不定义样式的情况下循环使用视图,如下所示:

<android.support.v7.widget.RecyclerView
  android:id="@+id/cardList"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:scrollbars="vertical"/>

如果您使用CardView或其他元素,您可以为其添加左右边框,然后滚动条保持在右侧,元素直到边缘:

<android.support.v7.widget.CardView
  xmlns:card_view="http://schemas.android.com/apk/res-auto"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_marginLeft="6dp"
  android:layout_marginStart="6dp"
  android:layout_marginRight="6dp"
  android:layout_marginEnd="6dp">

<android.support.v7.widget.CardView
  xmlns:card_view="http://schemas.android.com/apk/res-auto"
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_marginLeft="6dp"
  android:layout_marginStart="6dp"
  android:layout_marginRight="6dp"
  android:layout_marginEnd="6dp">