Material-components-android: [ViewPager2] overScrollMode doesn't work

Created on 22 Jul 2019  路  7Comments  路  Source: material-components/material-components-android

Description: I want to disable fading that a viewPager has scroll to edges. Just like this: https://stackoverflow.com/questions/27724923/remove-recyclerview-scroll-effects. But it still exists. Actually, I don't know if it is a bug, maybe it shoule be a new feature.

Expected behavior: ViewPager2 looks like ViewPager with overScrollMode="never"

Source code:

    <androidx.viewpager2.widget.ViewPager2
        android:orientation="vertical"
        android:overScrollMode="never"
        android:id="@+id/main_container_view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </androidx.viewpager2.widget.ViewPager2>

Android API version: Android API 29

Material Library version: implementation 'com.google.android.material:material:1.1.0-alpha08'

Device: Genymotion custom phone api 24

bug

Most helpful comment

This issue should be reopened.
The solution mentioned above is no more than a workaround since it relies on a private member and will not work if there is any changes in the view hierarchy inside ViewPager2.
Disabling over-scroll is a common need and should not be as hacky as this.

All 7 comments

@DavidZXY, why have you closed this bug? Have you found a solution?

I have the same problems!

ViewPager2 use RecyclerView to improve the performance锛宻o--
private ViewPager2 mMainContainerViewPager;
...
((RecyclerView)mMainContainerViewPager.getChildAt(0)).setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER); @sttimchenko @NikitaFrolovCR

This issue should be reopened.
The solution mentioned above is no more than a workaround since it relies on a private member and will not work if there is any changes in the view hierarchy inside ViewPager2.
Disabling over-scroll is a common need and should not be as hacky as this.

@DavidZXY can you reopen? if not ill open a new issue

@EhudPla @mxalbert1996 you are right.

Hi ViewPager is not part of our lib. Please file the bug

https://issuetracker.google.com/issues/new?component=561920

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Mirmuhsin picture Mirmuhsin  路  3Comments

ataulm picture ataulm  路  3Comments

MrCreeper1008 picture MrCreeper1008  路  3Comments

JakeWharton picture JakeWharton  路  3Comments

KelvinPac picture KelvinPac  路  3Comments