louiscad
10/07/2020, 8:38 PMsetContentView
in an Activity) the same as Compose at the root of an Activity, or is there layout render node related optimizations or whatever that cannot take place when Compose is used in a ViewGroup
?Zach Klippenstein (he/him) [MOD]
10/07/2020, 8:43 PMComponentActivity.setContent
just creates an AndroidComposeView
and sets it as the activity’s content view, so it doesn’t look like there’s any difference.
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.kt;l=156?q=ComponentActivity.setContentromainguy
10/07/2020, 9:01 PMlouiscad
10/07/2020, 9:01 PMAndroidOwner
is now… I mean, tomorrow or later after I sleep 😅romainguy
10/07/2020, 9:01 PMDecorView
around and who knows what elseViewRootImpl
doeslouiscad
10/07/2020, 9:03 PMDecorView
, but since I don't know anything about the layout render nodes you mentioned in the past, I was thinking it was an alternative to Views, and Compose could bypass android.view.View
altogether.romainguy
10/07/2020, 9:04 PMlouiscad
10/07/2020, 9:05 PMsetContent
that Zach linked?
Is it a sort of caching?setContentView(AndroidComposeView(this).view, DefaultLayoutParams)
setContentView
or put in any ViewGroup
with some layout params, without specific gotchas that need to "leak" implementation details at use site, that'll be quite helpful.romainguy
10/07/2020, 9:28 PMViewGroup.setContent
and ComponentActivity.setContent
Adam Powell
10/07/2020, 10:37 PMViewGroup.setContent
- prefer using ComposeView
and AbstractComposeView
for compose content 🙂AndroidComposeView
so that it's all the same thing and remove ViewGroup.setContent
- the latter only works in terms of a single View child of the ViewGroup receiver and as such it doesn't quite fit right