4

Hey I was wondering if it is possible to change the position of the scroll bar in Android RecyclerView. I would like to move the scroll bar closer to the right side of the display. If someone could just point me in the right direction with a link or something I would really appreciate that because currently I can't find anything on this.

Thanks!

1 Answer 1

2

I have only one workaround idea,

you can add to your main content layout only top and bottom padding (or margin).

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:fab="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingTop="4dp"
  android:paddingBottom="4dp">

Then RecyclerView without defining styles, like this:

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

and if you use CardView or other element, you can add left and right borders to him, then scrollbar keep on right side and element is not until the edges:

<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">
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.