we have created some extensions on View/Context to...
# anko
d
we have created some extensions on View/Context to retrieving attribute resources eg. drawable
Copy code
/**
 * Get drawable defined by attribute [attr]
 */
fun Context.attrDrawable(attr: Int): Drawable {
    val a = theme.obtainStyledAttributes(intArrayOf(attr))
    val attributeResourceId = a.getResourceId(0, 0)
    a.recycle()
    return drawable(attributeResourceId)
}
s
Thanks @david.bilik that is very useful.