Skip to content

Instantly share code, notes, and snippets.

@ricknout
Last active August 25, 2020 18:04
Show Gist options
  • Save ricknout/68d1408f3d880aaf8897d16716955621 to your computer and use it in GitHub Desktop.
Save ricknout/68d1408f3d880aaf8897d16716955621 to your computer and use it in GitHub Desktop.
MDC-Android MaterialShapeDrawable instantiation
/* Copyright 2020 Google LLC.
SPDX-License-Identifier: Apache-2.0 */
// Default constructor
val msd = MaterialShapeDrawable()
// ShapeAppearanceModel constructor
val msdFromSam = MaterialShapeDrawable(shapeAppearanceModel)
// Style/attr resources constructor (reads shapeAppearance and shapeAppearanceOverlay)
val msdFromStyles = MaterialShapeDrawable(context, attrs, defStyleAttr, defStyleRes)
// Cast from widget background
val msdFromWidget = widget.background as MaterialShapeDrawable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment