问题描述
我正在使用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版本设置为最新版本即可。