Created
November 22, 2018 20:17
-
-
Save bitvale/3f69a9afb4599fab6d9699d4f73a1d88 to your computer and use it in GitHub Desktop.
For Medium article "Android Dynamic Custom View is Easy"
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
override fun onDraw(canvas: Canvas ?) { | |
// draw switcher (green rect) | |
canvas?.drawRoundRect(switcherRect, switcherCornerRadius, switcherCornerRadius, switcherPaint) | |
// draw icon (white rect) | |
canvas?.withTranslation(x = iconTranslateX) { | |
drawRoundRect(iconRect, switcherCornerRadius, switcherCornerRadius, iconPaint) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment