Skip to content

Instantly share code, notes, and snippets.

@GRizzi91
Created August 3, 2021 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GRizzi91/2a8a76c0d079e6c70963d7ead5e0d2ff to your computer and use it in GitHub Desktop.
Save GRizzi91/2a8a76c0d079e6c70963d7ead5e0d2ff to your computer and use it in GitHub Desktop.
ConstraintSetExtension
fun ConstraintSet.setCardElevation(cardView: CardView, elevation: Float) {
getConstraint(cardView.id)?.let {
it.mCustomConstraints["CardElevation"] = ConstraintAttribute(
"CardElevation",
ConstraintAttribute.AttributeType.DIMENSION_TYPE,
elevation
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment