Created
November 23, 2020 17:25
-
-
Save adriantache/57a0ce08f46f6ead6b90f2e830c96775 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
fun View.setVisibility(visibility: Int) { | |
val motionLayout = parent as MotionLayout | |
motionLayout.constraintSetIds.forEach { | |
val constraintSet = motionLayout.getConstraintSet(it) ?: return@forEach | |
constraintSet.setVisibility(this.id, visibility) | |
constraintSet.applyTo(motionLayout) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment