Макет движения с индивидуальным флагом moveWhenScrollAtTop для просмотра

#android #android-layout #android-animation #android-motionlayout

#Android #android-макет #android-анимация #android-motionlayout

Вопрос:

Я хочу создать экран с макетом движения, вот схема макета:схема компоновки

  1. Заголовок виден, если пользователь находится поверх просмотра вторичной переработки, в противном случае он исчез;
  2. Фильтры, видимые, если пользователь проводит пальцем вверх, исчезают, если проводит пальцем вниз.

Есть проблемы, которые я не знаю, как я могу использовать одновременно moveWhenScrollAtTop=true для просмотра содержимого заголовка и moveWhenScrollAtTop=false для фильтров. Я пытался сделать это с помощью цепочки переходов, но это не работает

 lt;?xml version="1.0" encoding="utf-8"?gt; lt;MotionScene xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  xmlns:motion="http://schemas.android.com/apk/res-auto"gt;   lt;Transition  android:id="@ id/start"  app:constraintSetEnd="@ id/state_header_hidden"  app:constraintSetStart="@ id/state_idle"gt;  lt;OnSwipe  motion:dragDirection="dragUp"  motion:moveWhenScrollAtTop="true"  motion:touchAnchorId="@id/mainRv" /gt;  lt;/Transitiongt;   lt;Transition  android:id="@ id/end"  app:constraintSetEnd="@ id/state_filters_hidden"  app:constraintSetStart="@ id/state_header_hidden"gt;  lt;OnSwipe  motion:dragDirection="dragUp"  motion:moveWhenScrollAtTop="false"  motion:touchAnchorId="@id/mainRv" /gt;  lt;/Transitiongt;   lt;ConstraintSet android:id="@ id/state_idle"gt;  lt;Constraint  android:id="@ id/headerRv"  android:layout_width="0dp"  android:layout_height="wrap_content"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toTopOf="parent" /gt;   lt;Constraint  android:id="@ id/filtersRv"  android:layout_width="0dp"  android:layout_height="wrap_content"  android:paddingHorizontal="12dp"  android:paddingVertical="16dp"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@id/headerRv" /gt;   lt;ConstraintOverride  android:id="@id/mainRv"  motion:visibilityMode="ignore" /gt;   lt;/ConstraintSetgt;   lt;ConstraintSet android:id="@ id/state_header_hidden"gt;   lt;Constraint  android:id="@ id/headerRv"  android:layout_width="0dp"  android:layout_height="wrap_content"  app:layout_constraintBottom_toTopOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent" /gt;   lt;Constraint  android:id="@ id/filtersRv"  android:layout_width="0dp"  android:layout_height="wrap_content"  android:paddingHorizontal="12dp"  android:paddingVertical="16dp"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent"  app:layout_constraintTop_toBottomOf="@id/headerRv" /gt;   lt;ConstraintOverride  android:id="@id/mainRv"  motion:visibilityMode="ignore" /gt;   lt;/ConstraintSetgt;   lt;ConstraintSet android:id="@ id/state_filters_hidden"gt;   lt;Constraint  android:id="@ id/headerRv"  android:layout_width="0dp"  android:layout_height="wrap_content"  app:layout_constraintBottom_toTopOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent" /gt;   lt;Constraint  android:id="@ id/filtersRv"  android:layout_width="0dp"  android:layout_height="wrap_content"  android:paddingHorizontal="12dp"  android:paddingVertical="16dp"  app:layout_constraintBottom_toTopOf="parent"  app:layout_constraintEnd_toEndOf="parent"  app:layout_constraintStart_toStartOf="parent" /gt;   lt;ConstraintOverride  android:id="@id/mainRv"  motion:visibilityMode="ignore" /gt;   lt;/ConstraintSetgt; lt;/MotionScenegt;