Custom Touchable Animated View in Kotlin

If you wanted to draw your own view, and having some animated drawing, and in Kotlin… hope this would help.

Multi-touch animated growing circle (rain drop like)

As show below is a view that I’ll be showing how to create in this writing.

It has

  1. Multi touch capability. Each touch will draw a circle
  2. The circle will grow in size and fade in color… and disappear

Making Custom View

1. Implementing the View

Firstly you’ll need to implement from the View class, as it is the fundamental UI component of Android.

class RainDropView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0,
defStyleRes: Int = 0) :
View(context, attrs, defStyleAttr, defStyleRes)

The nice part of Kotlin is, you could now have all the constructors combined into one with default constructor.

--

--