TheOne1992
TheOne1992

Reputation: 9

Force GLSurfaceView to full screen

I am working on an App that captures the phone camera feed and display it into a GLSurfaceView and then in the renderer I add ImageViews to the screen in some specific coordinates.

The problem I am facing is that the camera feed in the GLSurfaceView is never full screen. In some Android versions it will put some black space horizontally in the top and bottom and in some other versions the black space will be smaller but vertical on the Left and Right of the screen.

I wanted to ask if there is any way to force fullscreen on every version ? I am fairly new to working with GLSurfaceView and nothing I tried works.

Upvotes: 0

Views: 1028

Answers (1)

Columbo
Columbo

Reputation: 6766

You could look into immersive mode to get rid of the system buttons if that's appropriate to your app: https://developer.android.com/training/system-ui/immersive

You should also look into the android.max_aspect manifest setting to eliminate black bars on very widescreen devices: https://android-developers.googleblog.com/2017/03/update-your-app-to-take-advantage-of.html

You should also look into supporting display cutouts (notches): https://developer.android.com/guide/topics/display-cutout/

As mentioned in the comments by BDL, if the screen and camera aspect ratio don't match, then you are going to have to have black bars, or cut off some content.

Upvotes: 1

Related Questions