android – Hide RecyclerView scrollbar-ThrowExceptions

Exception or error:

How can I remove the scrollbar in my recyclerview?
I’ve tried with mRecyclerView.setScrollBarSize(0); but it’s not working. (Actually, it doesn’t do anything, whatever the value I set).

How to solve:

Put android:scrollbars="none" like this:

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

Update for androidx library :

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none" >
    </androidx.recyclerview.widget.RecyclerView>

###

Add android:overScrollMode="never" and android:scrollbars="none" in your xml. The following example is with androidx RecyclerView:

<androidx.recyclerview.widget.RecyclerView
    ...
    android:scrollbars="none"
    android:overScrollMode="never">
</androidx.recyclerview.widget.RecyclerView>

Leave a Reply

Your email address will not be published. Required fields are marked *