Open xicong opened 5 years ago
我在使用AndroidX的时候,也碰到了这个问题。希望vlayout能尽快兼容下AndroidX。
@xicong 在proguard-rules.pro中添加
-keep class com.google.android.material.** {*;}
-keep class androidx.** {*;}
-keep public class * extends androidx.**
-keep interface androidx.** {*;}
-dontwarn com.google.android.material.**
-dontnote com.google.android.material.**
-dontwarn androidx.**
可以解决
好的,谢谢
涛声依旧啊...
2021-06-04 15:14:25.259 27748-27748/xxx W/VirtualLayoutManager: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.offsetTopAndBottom(int)' on a null object reference at androidx.recyclerview.widget.RecyclerView.offsetChildrenVertical(RecyclerView.java:5042) at androidx.recyclerview.widget.RecyclerView$LayoutManager.offsetChildrenVertical(RecyclerView.java:9136) at com.alibaba.android.vlayout.VirtualLayoutManager.offsetChildrenVertical(VirtualLayoutManager.java:667) at com.alibaba.android.vlayout.OrientationHelperEx$2.offsetChildren(OrientationHelperEx.java:266) at com.alibaba.android.vlayout.ExposeLinearLayoutManagerEx.scrollInternalBy(ExposeLinearLayoutManagerEx.java:994) at com.alibaba.android.vlayout.VirtualLayoutManager.scrollInternalBy(VirtualLayoutManager.java:601) at com.alibaba.android.vlayout.ExposeLinearLayoutManagerEx.scrollVerticallyBy(ExposeLinearLayoutManagerEx.java:959) at com.alibaba.android.vlayout.VirtualLayoutManager.scrollVerticallyBy(VirtualLayoutManager.java:72) at androidx.recyclerview.widget.RecyclerView.scrollStep(RecyclerView.java:1841) at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5302) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1018) at android.view.Choreographer.doCallbacks(Choreographer.java:837) at android.view.Choreographer.doFrame(Choreographer.java:763) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1003) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:230) at android.app.ActivityThread.main(ActivityThread.java:7823) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1034)
版本 implementation('com.alibaba.android:vlayout:1.2.22@aar') { transitive = true }
VirtualLayoutManager?.smoothScrollToPosition(mAcupointContentBinding.rvAcupoint,null,index)
日志
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.ViewGroup$LayoutParams android.view.View.getLayoutParams()' on a null object reference at androidx.recyclerview.widget.RecyclerView$LayoutManager$2.getChildStart(RecyclerView.java:7381) at androidx.recyclerview.widget.ViewBoundsCheck.findOneViewWithinBoundFlags(ViewBoundsCheck.java:223) at androidx.recyclerview.widget.LinearLayoutManager.findOneVisibleChild(LinearLayoutManager.java:1941) at androidx.recyclerview.widget.LinearLayoutManager.findFirstVisibleItemPosition(LinearLayoutManager.java:1857) at com.alibaba.android.vlayout.ExposeLinearLayoutManagerEx.findFirstVisibleItemPosition(ExposeLinearLayoutManagerEx.java:442) at com.alibaba.android.vlayout.VirtualLayoutManager.findFirstVisibleItemPosition(VirtualLayoutManager.java:72) at com.alibaba.android.vlayout.VirtualLayoutManager.runPostLayout(VirtualLayoutManager.java:480) at com.alibaba.android.vlayout.VirtualLayoutManager.onLayoutChildren(VirtualLayoutManager.java:542) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3647) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4194) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1732) at android.widget.LinearLayout.onLayout(LinearLayout.java:1497) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586) at android.widget.LinearLayout.onLayout(LinearLayout.java:1495) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336) at android.widget.FrameLayout.onLayout(FrameLayout.java:273) at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678) at android.view.View.layout(View.java:16636) at android.view.ViewGroup.layout(ViewGroup.java:5437) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2