Я работаю над макетом, в котором ConstraintLayout
является корневым представлением.Внутри есть кнопка RecyclerView
и TextView
.При нажатии кнопки вид добавляется к RecyclerView
, и кнопка опускается ниже.Но кнопка не анимируется.Как можно анимировать кнопку в соответствии со скоростью, с которой изображения добавляются в RecyclerView
?
EDIT :
Проблема кажется более глубокой, посколькупроблема с настройкой правильных размеров (у моего RecyclerView
есть высота, установленная на wrap_content
) для всех видов, поэтому я добавлю урезанную копию моего макета:
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:animateLayoutChanges="true"
android:background="@color/darkGrey"
android:focusableInTouchMode="true">
<include
layout="@layout/layout_item_toolbar"
android:id="@+id/toolbar"
/>
<androidx.core.widget.NestedScrollView
android:id="@+id/scrollView"
android:layout_width="0dp"
android:layout_height="0dp"
android:animateLayoutChanges="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
>
<EditText
android:id="@+id/etDuration"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:background="@drawable/edit_text_background"
android:elevation="1dp"
android:hint="Duration"
android:scrollHorizontally="false"
app:layout_constraintBottom_toTopOf="@+id/tvEndDate"
app:layout_constraintEnd_toStartOf="@+id/spDuration"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/chipGroup"
/>
<Spinner
android:id="@+id/spDuration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@+id/etDuration"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/etDuration"
app:layout_constraintTop_toTopOf="@id/etDuration"
/>
<TextView
android:id="@+id/tvEndDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toTopOf="@+id/tvAddTask"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etDuration"
/>
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="etDuration,tvEndDate"
/>
<TextView
android:id="@+id/tvNumberOfTasks"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="10dp"
app:layout_constraintBottom_toTopOf="@+id/rcvTasks"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/barrier3"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rcvTasks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintBottom_toTopOf="@+id/tvAddTask"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvNumberOfTasks"
/>
<TextView
android:id="@+id/tvAddTask"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rcvTasks"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>