https://kotlinlang.org logo
#compose
Title
# compose
a

Artur Schwarz

06/11/2021, 12:03 PM
Hi everyone! Can anyone explain why this is happening? This doesn’t happen when using views only. Could this be a bug in compose? Code in 🧵
Copy code
@Composable
fun MainScreenContent(previewView: PreviewView? = null) {
    val context = LocalContext.current

    Row(modifier = Modifier.fillMaxSize()) {
        AndroidView(modifier = Modifier.fillMaxHeight().weight(2f), factory = { ctx ->
            previewView ?: View(context)
        })
        Column(
            modifier = Modifier
                .fillMaxSize()
                .weight(0.7f)
                .padding(32.dp),
            verticalArrangement = Arrangement.SpaceBetween,
            horizontalAlignment = Alignment.CenterHorizontally
        ) {
            Text(style = MaterialTheme.typography.h2, text = "Fotos")
            LazyColumn() {

            }
            Button(modifier = Modifier.fillMaxWidth(), onClick = { /*TODO*/ }) {
                Text(text = "Aufnehmen")
            }
        }
    }
}
p

pawegio

06/11/2021, 2:20 PM
@Artur Schwarz I had a similar issue with CameraX in compose few months ago, the workaround was to use `TextureView`:
Copy code
previewView.implementationMode = PreviewView.ImplementationMode.COMPATIBLE
a

Artur Schwarz

06/13/2021, 9:37 AM
@pawegio Thank you!
n

Neal Sanche

06/22/2021, 6:52 PM
There's already a bug report in for this, and recently I heard it was assigned. So hopefully it'll get fixed soon.
👍 1
2 Views