addTo

inline fun <T : View> T.addTo(group: ViewGroup, block: T.() -> Unit = {}): T

Shorthand extension function to add a View into a ViewGroup, and then run a scoped function

Return

The View

Parameters

group

ViewGroup to add this View into

block

A scoped function, with the View as its receiver


inline fun <T : View> T.addTo(group: ViewGroup, index: Int, block: T.() -> Unit = {}): T

Shorthand extension function to add a View into a ViewGroup at specified index, and then run a scoped function

Return

The View

Parameters

group

ViewGroup to add this View into

index

Index to insert this View at

block

A scoped function, with the View as its receiver