Camera Preview Size

Eliseo Gamba 21 Reputation points
2021-04-20T01:35:44.457+00:00

Hi!

I follow this tutorial https://github.com/xamarin/xamarin-forms-samples/tree/master/CustomRenderers/View

In the picture in tutorial camara is in fullscreen but in my phone (Xiaomi Mi A2) just use 80% of the screen and i want picture cover all screen.

Anyone know how set fullscreen for camera?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
4,818 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JessieZhang-MSFT 7,516 Reputation points
    2021-04-20T08:51:22.83+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    The camera sensor is 4:3. The screen is usually 16:9. The sample code choose to show the entire camera preview, so part of the screen is not filled. You need to stretch to fill the whole screen, however in that case the images captured include areas not shown in the preview.

    If we really want to do this, we can try to change the android native code in android platform.

    please pay attention to class CameraFragment.cs in sample CustomRenderers/View/.

    For more details, you can refer to the following threads:
    https://stackoverflow.com/questions/41985926/camera2-full-screen-preview-and-image-capture .

    https://stackoverflow.com/questions/39044494/get-full-screen-preview-with-android-camera2

    Best Regards,

    Jessie Zhang

    ---
    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    No comments