From 64807fc73beda3677fd48d7d197186328512f5e7 Mon Sep 17 00:00:00 2001 From: zhpanvip Date: Sat, 11 Feb 2023 17:15:24 +0800 Subject: [PATCH] Try to fix issue #291 --- .../src/main/java/com/zhpan/bannerview/BannerViewPager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java index 31155e8..a5e6284 100644 --- a/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java +++ b/bannerview/src/main/java/com/zhpan/bannerview/BannerViewPager.java @@ -422,6 +422,8 @@ private void initRevealWidth(BannerOptions bannerOptions) { int orientation = bannerOptions.getOrientation(); int padding2 = bannerOptions.getPageMargin() + rightRevealWidth; int padding1 = bannerOptions.getPageMargin() + leftRevealWidth; + if (padding1 < 0) padding1 = 0; + if (padding2 < 0) padding2 = 0; if (orientation == ViewPager2.ORIENTATION_HORIZONTAL) { recyclerView.setPadding(padding1, 0, padding2, 0); } else if (orientation == ViewPager2.ORIENTATION_VERTICAL) {