更改Android RecyclerView中滚动条的位置
嘿,我想知道是否有可能改变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.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">