基本上,我想要做的是:
- 1.- 我有两个与活动“无关”的片段。
- 2.- 现在可能有两种情况,片段1或片段2必须以向上滑动的动画显示。
- 3.- 当两个片段都在屏幕上时,片段1总是在片段2的上方。
- 4.- 任何一个片段都可以隐藏,将显示的片段正确地放置在屏幕底部。
我对布局设计有点迷失。我已经尝试过
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fragment1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="-20dp"
android:visibility="gone" />
<FrameLayout
android:id="@+id/fragment2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="-20dp"
android:visibility="gone" />
</RelativeLayout>
我甚至同时展示它们两个。每个Fragment使用不同的FragmentTransaction。但是,使用android:layout_above
无法实现。
开发这个设计的最简单方法是什么?