Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/221.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android MotionLayout在RecyclerView滚动时崩溃_Android_Android Recyclerview_Android Constraintlayout_Android Motionlayout - Fatal编程技术网

Android MotionLayout在RecyclerView滚动时崩溃

Android MotionLayout在RecyclerView滚动时崩溃,android,android-recyclerview,android-constraintlayout,android-motionlayout,Android,Android Recyclerview,Android Constraintlayout,Android Motionlayout,我在MotionLayout中有RecyclerView 如下所示(例如,fragment_search_菜单布局中还有其他视图): 我有这个版本的ConstraintLayout(最新版本):androidx.ConstraintLayout:ConstraintLayout:2.0.0-beta7 我不知道该怎么处理这次事故这是一个已知的问题 请改用androidx.constraintlayout:constraintlayout:2.0.0-beta6因为崩溃说明您的回收器视图的适配器中

我在MotionLayout中有RecyclerView

如下所示(例如,fragment_search_菜单布局中还有其他视图):

我有这个版本的ConstraintLayout(最新版本):androidx.ConstraintLayout:ConstraintLayout:2.0.0-beta7

我不知道该怎么处理这次事故这是一个已知的问题


请改用androidx.constraintlayout:constraintlayout:2.0.0-beta6

因为崩溃说明您的回收器视图的适配器中应该有错误,它希望从项中获取ID(),但该项为空谢谢,我将其还原为beta6并重建了我的项目。现在没事了,嗨@RomanOstanin,如果我的回答解决了你的问题,请接受。谢谢
<androidx.constraintlayout.motion.widget.MotionLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_search_motion"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layoutDescription="@xml/fragment_search_scene"
    tools:showPaths="true">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragment_search_map"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toTopOf="@+id/fragment_search_spacer"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Space
        android:id="@+id/fragment_search_spacer"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/large_gap"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="@+id/fragment_search_menu" />

    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/fragment_search_menu"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@drawable/background_rounded_corners_gray"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHeight_percent="0.63"
        app:layout_constraintStart_toStartOf="parent">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/fragment_search_menu_recycler"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.constraintlayout.motion.widget.MotionLayout>
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getId()' on a null object reference
        at androidx.constraintlayout.motion.widget.MotionLayout.onNestedPreScroll(MotionLayout.java:2200)
        at androidx.core.view.ViewParentCompat.onNestedPreScroll(ViewParentCompat.java:386)
        at androidx.core.view.NestedScrollingChildHelper.dispatchNestedPreScroll(NestedScrollingChildHelper.java:322)
        at androidx.recyclerview.widget.RecyclerView.dispatchNestedPreScroll(RecyclerView.java:11595)
        at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5286)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:966)
        at android.view.Choreographer.doCallbacks(Choreographer.java:778)
        at android.view.Choreographer.doFrame(Choreographer.java:710)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:952)
        at android.os.Handler.handleCallback(Handler.java:790)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6518)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)