Custom Touchable Animated View in Kotlin
Published in
3 min readJul 31, 2018
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
- Multi touch capability. Each touch will draw a circle
- 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.