ComposeView
class ComposeView
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) :
AbstractComposeView(context, attrs, defStyleAttr)
A android.view.View that can host Jetpack Compose UI content. Use setContent to supply the
content composable function for the view.
By default, the composition is disposed according to ViewCompositionStrategy.Default. Call
disposeComposition to dispose of the underlying composition earlier, or if the view is never
initially attached to a window. (The requirement to dispose of the composition explicitly in the
event that the view is never (re)attached is temporary.)
ComposeView only supports being added into view hierarchies propagating LifecycleOwner and
SavedStateRegistryOwner via androidx.lifecycle.setViewTreeLifecycleOwner and
androidx.savedstate.setViewTreeSavedStateRegistryOwner. In most cases you will already have it
set up correctly as androidx.activity.ComponentActivity, androidx.fragment.app.Fragment and
androidx.navigation.NavController will provide the correct values.
Functions
fun setContent(content: @Composable () -> Unit)
Set the Jetpack Compose UI content for this view. Initial composition will occur when the
view becomes attached to a window or when createComposition is called, whichever comes
first.
