【发布时间】:2019-07-23 15:58:10
【问题描述】:
我一定遗漏了 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 并添加一个框架布局作为 Activity 的根并隐藏整个 MotionLayout。但这不太理想,因为我必须复制工具栏和图标。所以我想问题是关于可见性变化和潜在的 z 排序?
我正在使用androidx.constraintlayout:constraintlayout:2.0.0-beta2
【问题讨论】:
-
遇到了同样的问题,使用 alpha 解决了
-
@RameesThattarath 澄清您切换回 alpha 并解决了问题?如果是哪个版本。
-
androidx.constraintlayout:constraintlayout:2.0.0-beta1
-
嗯...谢谢您的回复。但是,
2.0.0-beta1和2.0.0-beta2之间的行为相同。
标签: android android-motionlayout