Why doesn't `include` set the parent container whe...
# anko
k
Why doesn't
include
set the parent container when inflating the xml layout? It's implemented as
Copy code
inline fun <T: View> ViewManager.include(layoutId: Int, init: T.() -> Unit): T {
    @Suppress("UNCHECKED_CAST")
    return ankoView({ ctx -> ctx.layoutInflater.inflate(layoutId, null) as T }) { init() }
}
why not have an overload where the receiver is of type
ViewGroup
and it is passed as the second argument to
inflate
like so:
Copy code
inline fun <T : View> ViewGroup.include(layoutId: Int, init: T.() -> Unit): T {
    @Suppress("UNCHECKED_CAST")
    return ankoView({ ctx -> ctx.layoutInflater.inflate(layoutId, this@include, false) as T }) { init() }
}
👍 1
📌 1