Hello,
If you want to detect the scroll event in ViewPager2, you can RegisterOnPageChangeCallback
in the ViewPager2 with viewpager2.RegisterOnPageChangeCallback(new MyViewPagerChange());
, then override the OnPageSelected
and OnPageScrolled
like following code.
internal class MyViewPagerChange : ViewPager2.OnPageChangeCallback {
public override void OnPageSelected(int position){
base.OnPageSelected(position);
}
public override void OnPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
base.OnPageScrolled(position, positionOffset, positionOffsetPixels);
}
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.