Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recyclerview scrollbar cliptoPadding false?

I have a recyclerview with padding top and bottom for 10dp.

And I add clipToPadding=false like so:

<android.support.v7.widget.RecyclerView
    android:id="@+id/contentView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingStart="@dimen/margin_medium"
    android:paddingTop="@dimen/margin_medium"
    android:paddingBottom="@dimen/margin_medium"
    android:clipToPadding="false"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    android:scrollbars="vertical" />

I notice that my scrollbar will actually respect the top and bottom padding, and does not scroll the whole height.

Is there a way so that my scrollbar actually scrolls top and bottom completely?

like image 726
Zhen Liu Avatar asked Aug 17 '17 15:08

Zhen Liu


1 Answers

You just need to add android:scrollbarStyle="outsideOverlay" to your recyclerView.

ref - https://developer.android.com/reference/android/view/View.html#attr_android:scrollbarStyle

You can achieve similar scrollbar results with it.

scrollbar outside overlay

like image 114
Jobin Lawrance Avatar answered Oct 05 '22 07:10

Jobin Lawrance