You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 13, 2020. It is now read-only.
inline fun <T: View> Context.include(layoutId: Int, init: (@AnkoViewDslMarker T).() -> Unit): T { @Suppress("UNCHECKED_CAST") return ankoView({ ctx -> ctx.layoutInflater.inflate(layoutId, null) as T }, 0) { init() } } inline fun <T: View> Activity.include(layoutId: Int, init: (@AnkoViewDslMarker T).() -> Unit): T { @Suppress("UNCHECKED_CAST") return ankoView({ ctx -> ctx.layoutInflater.inflate(layoutId, null) as T }, 0) { init() } }
I use include to help me of inflating View in custom view, and recyclerView's item ,but some times is not simply, for example:
when i want to inflate an RecyclerView item, i will call Inflater.from.inflate(R.layout.xxxx,parents, false);
when i want to just create a View, i will call Inflater.from.inflate(R.layout.xxx, null, false);
when i want to create a custom View,i will call Inflter.from.inflate(R.layout.xxx, this, true);
but anko not support to put the enough parameters to select.
also:
i want to create a Linearlayout by anko in activity, but don't set it to ContentView ,I can't call Activity.include instead of Context.include, so i must force convert 'Activity' to 'Context', that makes me entangled