Moisoni Ioan
Moisoni Ioan

Reputation: 1425

Disable overglow effect in ViewPager2

Can not remove the glow effect on over-scroll in TabLayout with ViewPager2.

I have tried android:overScrollMode="never" and android:fadingEdge="none" but it doesn't work.

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

Upvotes: 1

Views: 787

Answers (2)

Moisoni Ioan
Moisoni Ioan

Reputation: 1425

As @Anatolii Chub mentioned, it is an issue. He provided a link to a workaround in Kotlin but I use Java in my project so this is the solution:

//disable glow effect when over-scroll
if (viewPager2.getChildAt(0) instanceof RecyclerView) {
    viewPager2.getChildAt(0).setOverScrollMode(View.OVER_SCROLL_NEVER);
}

His answer will remain accepted because he provided info for solution.

Upvotes: 0

Anatolii Chub
Anatolii Chub

Reputation: 1300

You're right, android:overScrollMode="never" is not disabling the over scroll effect. The respective issue created on the issue tracker: https://issuetracker.google.com/issues/134912610

But you can try workaround, described in this answer.

Upvotes: 2

Related Questions