我一定错过了 android:visibility 在动作布局中的变化。这是我的布局的简化版本。
<MotionLayout>
<ImageView android:id="@+id/HeaderBackground" />
Bunch of image views, Text views that are constrainted to the HeaderBackground.
<RecyclerView android:visibility="visible">
<EditText android:visibility="visible">
<CustomViewGroup1 android:visibility="gone">
</MotionLayout>
我有一个motionScreen,它基于回收器视图设置一个Transition onswipe,以降低HeaderBackground 的高度并隐藏一些图像/文本视图(即折叠工具栏)。但是,如果有一些致命错误,我想在 RecyclerView 的顶部/前面显示 CustomViewGroup1,但是将 RecyclerView 的可见性切换为消失并且将 CustomViewGroup1 切换为可见不会使 CustomViewGroup1 显示。
我可以将 CustomViewGroup 组移出 MotionLayout 并添加一个框架布局作为活动的根并隐藏整个 MotionLayout。但这不太理想,因为我必须复制工具栏和图标。所以我想问题是关于可见性变化和潜在的 z 排序?
我在用着androidx.constraintlayout:constraintlayout:2.0.0-beta2