Skip to content

Instantly share code, notes, and snippets.

@ademar111190
Created June 17, 2019 16:53
Show Gist options
  • Save ademar111190/f4e7dc7c9641e82fc0ec404a7c0cd363 to your computer and use it in GitHub Desktop.
Save ademar111190/f4e7dc7c9641e82fc0ec404a7c0cd363 to your computer and use it in GitHub Desktop.
Step 8, the Rect
...
private var rect = Rect()
...
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
canvas.clipRect(rect)
backgroundDrawable.draw(canvas)
}
private fun updateRect(rect: Rect) {
this.rect = rect
postInvalidate()
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment