Created
June 29, 2018 12:55
-
-
Save Subtle-fox/784c638d66f18ba693a0c481953bcdda to your computer and use it in GitHub Desktop.
Modify constraints programmatically
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
ConstraintSet set = new ConstraintSet(); | |
ConstraintLayout layout; | |
layout = (ConstraintLayout) findViewById(R.id.layout); | |
set.clone(layout); | |
// The following breaks the connection. | |
set.clear(R.id.bottomText, ConstraintSet.TOP); | |
// Comment out line above and uncomment line below to make the connection. | |
// set.connect(R.id.bottomText, ConstraintSet.TOP, R.id.imageView, ConstraintSet.BOTTOM, 0); | |
set.applyTo(layout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment