0

I load a smiliar layout when my fragment starts:

<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>

When the fragment starts I want my firstView to be (so to speak) hidden and when a user scrolls down it should move with secondView so it becomes visible.

Basically I would like my ScrollView to be started with negative position. The problem is I don't know the height of firstView.

Is it possible to define this behavior with xml attributes?

Regards,
roncsak

roncsak
  • 618
  • 1
  • 8
  • 21

1 Answers1

0

Well, it can be done with CollapsingToolbarLayout.

Material design spec: https://material.io/develop/android/components/collapsing-toolbar-layout/

roncsak
  • 618
  • 1
  • 8
  • 21