Camposer
Camposer copied to clipboard
CameraPreview extends over parent size on API level 24
- Device: Emulator, Hardware profile "Small Phone" in Android studio.
- Android version: 7 API level 24
- Library version: 0.4.0
Describe the bug
The camera preview does not respect size constrains. I have set the height with .height(), .weight(), .fillMaxHeight(). But nothing works. The only thing that seems to affect it is padding, but that will also affect all other screen sizes and API levels.
I have tested with API level 24 and 30 with the same screensize, and it only happens on level 24.
To Reproduce
- Create "small phone" with API level 24
- Create a CameraPreview
Screenshots
Hello @Walmann, thank you for addressing the issue.
I've made an attempt to reproduce it, but I couldn't replicate the same problem. Occasionally, there are compatibility issues with compose interoperability that result in such occurrences.
However, maybe an another solution could be to encapsulate the CameraPreview within a Box composable and apply constraints to it, this approach might help resolve the issue, eg:
Box(
modifier = Modifier.size(200.dp, 300.dp) // set your constraint here
) {
CameraPreview(
// ...
)
}
In the meantime, I'll continue to investigate this issue further. Thank you for your patience π