Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
596 views
in Technique[技术] by (71.8m points)

android - java.lang.UnsupportedOperationException: RecyclerView does not support scrolling to an absolute position

Getting this error on Samsung GT-S7562 Android 4.0.4. I am not calling scrollTo method through code. It is getting called internally. Please help

java.lang.UnsupportedOperationException: RecyclerView does not support scrolling to an absolute position.
            at android.support.v7.widget.RecyclerView.scrollTo(RecyclerView.java:941)
            at android.view.View.setScrollX(View.java:7010)
            at android.animation.PropertyValuesHolder.nCallIntMethod(Native Method)
            at android.animation.PropertyValuesHolder.access$200(PropertyValuesHolder.java:35)
            at android.animation.PropertyValuesHolder$IntPropertyValuesHolder.setAnimatedValue(PropertyValuesHolder.java:815)
            at android.animation.ObjectAnimator.animateValue(ObjectAnimator.java:476)
            at android.animation.ValueAnimator.animationFrame(ValueAnimator.java:1145)
            at android.animation.ValueAnimator.setCurrentPlayTime(ValueAnimator.java:551)
            at android.animation.LayoutTransition.startChangingAnimations(LayoutTransition.java:813)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1805)
            at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2632)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4517)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:993)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
            at dalvik.system.NativeStart.main(Native Method)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had same problem, for me it was because I had

android:animateLayoutChanges="true"

for my recycler view's parent. I removed that and it worked.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...