bohregard
05/18/2020, 10:51 PM@Composable
fun buildUi() {
Column(
modifier = Modifier.fillMaxSize(),
horizontalGravity = Alignment.CenterHorizontally
) {
SurfaceView(ContextAmbient.current)
}
}
bohregard
05/18/2020, 10:53 PMLeland Richardson [G]
05/18/2020, 11:04 PMemit
, a lot might show up.
Compose’s compiler intercepts calls to android view constructors inside of composable functions. So basically, the constructor you are trying to call isn’t resolvable inside of a composable function (the IDE integration for this is still shotty which is one reason why we don’t talk about dealing with views this way very often)Leland Richardson [G]
05/18/2020, 11:05 PMSurfaceView()
Leland Richardson [G]
05/18/2020, 11:05 PMLeland Richardson [G]
05/18/2020, 11:05 PMSurfaceView(id=123)
Leland Richardson [G]
05/18/2020, 11:06 PMLeland Richardson [G]
05/18/2020, 11:06 PMLeland Richardson [G]
05/18/2020, 11:08 PMescapeCompose
function:
val view = escapeCompose { SurfaceView(context) }
bohregard
05/18/2020, 11:30 PMbohregard
05/18/2020, 11:30 PMbohregard
05/18/2020, 11:31 PMromainguy
05/18/2020, 11:31 PMAndroidView(layoutResourceId) { inflatedView -> /* … */ }
Adrian Blanco
05/19/2020, 7:27 AMLeland Richardson [G]
05/19/2020, 2:20 PM