It's ok, but you can remove some boilerplate by us...
# android
m
It's ok, but you can remove some boilerplate by using primary constructor and
init
block like this:
Copy code
class MyView @JvmOverloads constructor(
        context: Context,
        attrs: AttributeSet? = null,
        defStyleAttr: Int = 0)
    :
        FrameLayout(context, attrs, defStyleAttr) {

    init {
        View.inflate(context, R.layout.my_view, this)
    }

// ...
👍 3
K 1