Skip to content

Instantly share code, notes, and snippets.

@AradiPatrik
Created December 27, 2020 09:27
Show Gist options
  • Save AradiPatrik/99523315175b692026637a1a3a2766cf to your computer and use it in GitHub Desktop.
Save AradiPatrik/99523315175b692026637a1a3a2766cf to your computer and use it in GitHub Desktop.
The View gets pushed up by the RecyclerView but never out of screen
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.motion.widget.MotionLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layoutDescription="@xml/motion_scene"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<View
android:id="@+id/header"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="#5598ff"
android:layout_width="0dp"
android:layout_height="78dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/header"
android:layout_width="0dp"
android:layout_height="100dp" />
</androidx.constraintlayout.motion.widget.MotionLayout>
<?xml version="1.0" encoding="utf-8"?>
<MotionScene xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<Transition android:id="@+id/begin_to_end"
app:constraintSetStart="@id/begin"
app:constraintSetEnd="@id/end">
<OnSwipe app:touchAnchorId="@id/recycler_view"
app:touchAnchorSide="top"
app:dragDirection="dragUp" />
</Transition>
<ConstraintSet android:id="@+id/begin"/>
<ConstraintSet android:id="@+id/end">
<Constraint android:id="@id/recycler_view">
<Layout
app:layout_constraintTop_toBottomOf="@id/header"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="0dp"
android:layout_height="0dp" />
</Constraint>
<Constraint android:id="@id/header">
<Layout
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="0dp"
android:layout_height="78dp" />
</Constraint>
</ConstraintSet>
</MotionScene>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment