ViewCompositionStrategy |
Description |
---|---|
DisposeOnDetachedFromWindow |
The Composition will be disposed when the underlying ComposeView is detached from the window. Has since been superseded by DisposeOnDetachedFromWindowOrReleasedFromPool .Interop scenario: * ComposeView whether it’s the sole element in the View hierarchy, or in the context of a mixed View/Compose screen (not in Fragment). |
DisposeOnDetachedFromWindowOrReleasedFromPool (Default) |
Similar to DisposeOnDetachedFromWindow , when the Composition is not in a pooling container, such as a RecyclerView . If it is in a pooling container, it will dispose when either the pooling container itself detaches from the window, or when the item is being discarded (i.e. when the pool is full).Interop scenario: * ComposeView whether it's the sole element in the View hierarchy, or in the context of a mixed View/Compose screen (not in Fragment).* ComposeView as an item in a pooling container such as RecyclerView . |
DisposeOnLifecycleDestroyed |
The Composition will be disposed when the provided Lifecycle is destroyed.Interop scenario * ComposeView in a Fragment's View. |
DisposeOnViewTreeLifecycleDestroyed |
The Composition will be disposed when the Lifecycle owned by the LifecycleOwner returned by ViewTreeLifecycleOwner.get of the next window the View is attached to is destroyed.Interop scenario: * ComposeView in a Fragment's View.* ComposeView in a View wherein the Lifecycle is not known yet. |
Created
May 4, 2023 20:48
-
-
Save arriolac/7b0fd9f676159b4785ec7d48f0f57d39 to your computer and use it in GitHub Desktop.
ViewCompositionStrategy Table
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment