Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CameraPreview extends over parent size on API level 24 #45

Open
Walmann opened this issue Apr 26, 2024 · 1 comment
Open

CameraPreview extends over parent size on API level 24 #45

Walmann opened this issue Apr 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Walmann
Copy link

Walmann commented Apr 26, 2024

  • 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

smallPhone

@ujizin
Copy link
Owner

ujizin commented May 2, 2024

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 😄

@ujizin ujizin added the bug Something isn't working label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants