@JvmOverloads fun Context.inflate(layoutRes: Int, parent: ViewGroup? = null, attachToRoot: Boolean = false): View
inflate view
layoutRes
- layout resource to inflate
parent
- Optional view to be the parent of the generated hierarchy (if attachToRoot is true),
or else simply an object that provides a set of LayoutParams values for root of the returned hierarchy
(if attachToRoot is false.)
This value may be null.
attachToRoot
- Whether the inflated hierarchy should be attached to the root parameter?
If false, root is only used to create the correct subclass of LayoutParams for
the root view in the XML.
Return
The root View of the inflated hierarchy.