I've got a RecyclerView
and would like to have scrollbar showing, when it covers more than one page.
I get no scrollbar at all. Any idea?
My layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <CheckBox android:id="@+id/cl_only_empty" android:layout_width="match_parent" android:layout_height="wrap_content" android:elevation="5dp" android:text="@string/cl_only_empty" android:textColor="@color/white" /> <android.support.v7.widget.RecyclerView android:id="@+id/callsList" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" /> </LinearLayout>
Setting the android:scrollbarFadeDuration="0" will do the trick.
First you need to define styling in Style.xml file: Add the code to Recycler view xml to make scroll bar visible. Actually, it's because of the theme. The scrollbars are there but can't be seen because they blend with the color on the parent view or some other view in the line of its ancestors.
Scroller can be set to recyclerview on multiple ways. 1st you can simply add scrollbar in xml and set its property android:fadeScrollbars="false" to always show it. Show activity on this post. Show activity on this post.
After that when I scroll down or go up the view back to its normal position like the changes that I made it’s gone from view. It is because RecyclerView recycles every view which is not visible to the user. So, when the user scrolls back it recycles the previous view which is in normal form.
This way, the vertical scrollbar is always showing when it's using more height of the layout permitted. Show activity on this post. Scroller can be set to recyclerview on multiple ways. 1st you can simply add scrollbar in xml and set its property android:fadeScrollbars="false" to always show it.
The solution is to set the vertical (or horizontal) scrollbar in the xml layout:
<android.support.v7.widget.RecyclerView android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With