Android MotionLayout + Recyclerview,recyclerview中的视图不可单击

问题描述

我正在使用MotionLayout播放RecyclerView,.xml中的结构类似于

<ConstraintLayout>

    <MotionLayout>

        <OtherView...>

        <RecylerView>

        </RecylerView>

    </MotionLayout>

</ConstraintLayout>

MotionLayout的一种行为是在上下拖动MotionLayout时,RecyclerView随即进行缩放,直到顶部

除了从RecyclerView快速滚动几秒钟后,在几秒钟内都无法单击RecyclerView中的视图外,其他所有东西都工作正常。我认为可能是由于某些渲染问题,因为每次上下滚动时,RecyclerView中视图的位置也会被替换。 我正在使用的MotionLayout版本是2.0.1,

<MotionScene xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <!-- 1 -->
    <Transition
        app:constraintSetEnd="@id/end"
        app:constraintSetStart="@id/start"
        app:duration="1000">

        <OnSwipe
            app:dragDirection="dragUp"
            app:touchAnchorId="@+id/rvContent"
            app:touchAnchorSide="top" />

    </Transition>

    <!-- 2 -->
    <ConstraintSet android:id="@+id/start">
        <Constraint android:id="@id/txtTitle">
            <PropertySet app:alpha="1" />
        </Constraint>
        <Constraint android:id="@id/txtSubtitle">
            <PropertySet app:alpha="1" />
        </Constraint>
    </ConstraintSet>

    <Some Other ConstraintSet...>

</MotionLayout>

有人可以给我一些解决方法吗?谢谢。

解决方法

好的,我已经解决了这个错误。该错误来自recyclerview和motionlayot之间的兼容性。只需将您的recyclerview版本设置为最新版本即可。

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...