Kotlin: How to access the Attrs for a CustomView
<p>I create a custom view in Kotlin, and would like to access it's Attributes Resource.</p>

<p>Below is my code</p>

<pre><code>class CustomCardView : FrameLayout {

    constructor(context: Context) : super(context)

    constructor(context: Context, attrs: AttributeSet) : super(context, attrs)

    constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

    init {
        LayoutInflater.from(context).inflate(R.layout.view_custom_card, this, true)

        if (attrs != null) {
            val a = context.obtainStyledAttributes(attrs, R.styleable.custom_card_view)
            if (a.hasValue(R.styleable.custom_card_view_command)) {
                var myString = a.getString(R.styleable.custom_card_view_command)
            }
        }
    }
}
</code></pre>

<p>Note that this will error in the <code>attrs</code> in the init function. I'm wondering how to access the <code>attrs</code>?</p>