It is a simple project that makes animations using constraintSet.
- layout_first.xml
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
android:id = "@+id/constraint_photo"
>
<ImageView
android:id = "@+id/img_photo"
android:layout_width = "0dp"
android:layout_height = "0dp"
app:layout_constraintBottom_toBottomOf = "parent"
app:layout_constraintEnd_toEndOf = "parent"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent"
/>
<TextView
android:id = "@+id/text_photo"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
app:layout_constraintTop_toBottomOf = "parent"
/>
- layout_second.xml
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android = "http://schemas.android.com/apk/res/android"
xmlns:app = "http://schemas.android.com/apk/res-auto"
>
<ImageView
android:id = "@+id/img_photo"
android:layout_width = "match_parent"
android:layout_height = "350dp"
app:layout_constraintStart_toStartOf = "parent"
app:layout_constraintTop_toTopOf = "parent"
/>
<TextView
android:id = "@+id/text_date"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
app:layout_constraintBottom_toBottomOf = "@+id/img_photo"
/>
<TextView
android:id = "@+id/text_photo"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
app:layout_constraintTop_toBottomOf = "@+id/text_date"
/>
- Your activity.
ConstraintSet().apply {
clone(this@PhotoActivity, R.layout.layout_second) //clone detail layout.
ChangeBounds().apply { //you can customize.
duration = 1100
interpolator = AnticipateOvershootInterpolator(0.5f)
TransitionManager.beginDelayedTransition(constraint_photo, this)
}
applyTo(constraint_photo)
}
This project's gradle version is 3.2.1