Skip to content

Instantly share code, notes, and snippets.

@RamiJ3mli
Created August 20, 2018 09:38
Show Gist options
  • Save RamiJ3mli/098bad4e568d8dbf20eebb1938ece30d to your computer and use it in GitHub Desktop.
Save RamiJ3mli/098bad4e568d8dbf20eebb1938ece30d to your computer and use it in GitHub Desktop.
ConstraintSet c = new ConstraintSet();
c.clone(constraintLayout);
c.constrainHeight(R.id.image, ConstraintSet.MATCH_CONSTRAINT);
c.constrainWidth(R.id.image, ConstraintSet.MATCH_CONSTRAINT);
c.setDimensionRatio(R.id.image, "16:9");
c.connect(R.id.image, ConstraintSet.LEFT, R.id.left_ruler, ConstraintSet.LEFT);
c.connect(R.id.image, ConstraintSet.RIGHT, R.id.right_ruler, ConstraintSet.RIGHT);
c.applyTo(mConstraintLayout);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment