Created
May 31, 2017 07:38
-
-
Save kmshack/488d2f92c83cc9f8cac1c9a00b190134 to your computer and use it in GitHub Desktop.
mainCode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
... | |
val constraintSet1 = ConstraintSet() | |
constraintSet1.clone(constraintLayout) | |
val constraintSet2 = ConstraintSet() | |
constraintSet2.clone(constraintLayout) | |
constraintSet2.centerVertically(R.id.image, 0) | |
var changed = false | |
findViewById(R.id.button).setOnClickListener { | |
TransitionManager.beginDelayedTransition(constraintLayout) | |
val constraint = if (changed) constraintSet1 else constraintSet2 | |
constraint.applyTo(constraintLayout) | |
changed = !changed | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment