Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollbar not showing in RecyclerView

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> 
like image 517
Michael Schmidt Avatar asked Dec 09 '14 10:12

Michael Schmidt


People also ask

How to always show scrollbar in RecyclerView android?

Setting the android:scrollbarFadeDuration="0" will do the trick.

How to make scrollbars visible in Recycler view?

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.

How to set scroller to recyclerview?

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.

Why does my view disappear when I scroll down or back?

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.

How to make the vertical scrollbar always show?

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.


1 Answers

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" /> 
like image 156
jbiral Avatar answered Sep 22 '22 11:09

jbiral