相关疑难解决方法(0)

android:MotionLayout子级的可见性更改

我必须在动作布局中缺少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>
Run Code Online (Sandbox Code Playgroud)

我有一个MotionScreen,它基于回收者视图设置了一个onswipe过渡,以减小HeaderBackground的高度并隐藏一些图像/文本视图(例如,折叠工具栏)。但是,如果出现一些致命错误,我想在RecyclerView的顶部/前面显示CustomViewGroup1,但是将RecyclerView的可见性切换为“消失”,而将CustomViewGroup1切换为可见,则不会显示CustomViewGroup1。

我可以将CustomViewGroup组从MotionLayout中移出,并添加framelayout作为活动的根,并隐藏整个MotionLayout。但这并不理想,因为我必须复制工具栏和图标。所以我想问题是关于可见性的变化和潜在的z顺序?

我正在使用 androidx.constraintlayout:constraintlayout:2.0.0-beta2

android android-motionlayout

6
推荐指数
3
解决办法
680
查看次数

标签 统计

android ×1

android-motionlayout ×1