zhpanvip / BannerViewPager

🚀 An awesome banner view for Android,Based on ViewPager2. 这可能是全网最好用的ViewPager轮播图。简单、高效,一行代码实现循环轮播,一屏三页任意变,指示器样式任你挑。
Apache License 2.0
3.62k stars 438 forks source link

IllegalStateException: Page can only be offset by a positive amount, not by-940 #148

Closed luodongwen closed 4 years ago

luodongwen commented 4 years ago

java.lang.IllegalStateException: Page can only be offset by a positive amount, not by -940 at androidx.viewpager2.widget.ScrollEventAdapter.updateScrollEventValues(ScrollEventAdapter.java:280) at androidx.viewpager2.widget.ScrollEventAdapter.onScrolled(ScrollEventAdapter.java:178) at androidx.recyclerview.widget.RecyclerView.dispatchOnScrolled(RecyclerView.java:5183) at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5348) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1132) at android.view.Choreographer.doCallbacks(Choreographer.java:943) at android.view.Choreographer.doFrame(Choreographer.java:850) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1118) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7012) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:937)

<com.scwang.smart.refresh.layout.SmartRefreshLayout android:id="@+id/refreshLayout" android:layout_width="match_parent" android:layout_height="match_parent">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/rv_classify_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginTop="@dimen/core_spa_small" />
    </com.scwang.smart.refresh.layout.SmartRefreshLayout>

addHeader Banner 的时候报错。BaseRecyclerViewAdapterHelper 把banner加进头部的时候报错。看异常像是动画导致的崩溃 2.6.6没事

zhpanvip commented 4 years ago

请改成用代码设置revealWidth。 这个问题会在下个版本会修复。

luodongwen commented 4 years ago

代码设置revealWidth是啥。没看懂

zhpanvip commented 4 years ago

代码设置revealWidth是啥。没看懂

你是不是设置了一屏三页样式了?

zhpanvip commented 4 years ago

Fixed in v3.1.6

peter100u commented 1 year ago

没搞懂,什么是revealWidth, 怎么解决 ?麻烦说下原因

peter100u commented 1 year ago

麻烦说下原因,我遇到类似问题,但是无法重现