Created
May 31, 2017 07:38
-
-
Save kmshack/f733c0881e01eb71eb7ad122376281cd to your computer and use it in GitHub Desktop.
main.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(this, R.layout.activity_main_alt) | |
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