Hey folks, I’d like to follow up this post I found in search with a question:
https://kotlinlang.slack.com/archives/CJLTWPH7S/p1637659659341600
This is most related to the issue I’m having where I can’t see previews of compose objects in XML (see attached image). We’re integrated compose into our databinding layouts and we aren’t able to get any previews. Given how
<androidx.compose.ui.platform.ComposeView
works, and points to something like:
binding.payButtonLayout.composeButton.apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindow)
setContent {
MaterialTheme {
Button(onClick = {}) {
Text("My button")
}
}
}
}
I’ve tried using the
tools:composableName="androidx.compose.material.ButtonKt"
,
<androidx.compose.ui.tooling.ComposeViewAdapter
and even making my own view by inheriting from
AbstractComposeView
but still no preview.
Would I be correct in saying that this just isn’t possible to do? Thanks in advance!