我的片段开始时加载一个简单的布局:
<ScrollView
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/firstView" />
<View
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/secondView" />
</LinearLayout>
</ScrollView>
片段开始时,我希望我的firstView
被隐藏起来,而当用户向下滚动时,它应该与secondView
一起移动,以使其可见。
基本上,我希望我的ScrollView从负位置开始。问题是我不知道firstView
的高度。
是否可以使用xml属性定义此行为?
致谢,
朗恰克
答案 0 :(得分:0)
好吧,可以使用CollapsingToolbarLayout完成。
材料设计规范:https://material.io/develop/android/components/collapsing-toolbar-layout/