How to programmatically control Preview size of Android camera app
It’s been a while since I posted an article about how we take a photo using Camera2 API. Today I’m going to share the way to control the screen size of the preview.
First, let me go through the necessary steps to configure the preview screen. Then I will explain two camera app examples — the first one is a full-screen preview and the other one with the preview which fits the width of a screen.
If you want to peek the code first, here’s a link to it:
Step by step guide to understand how to configure the preview screen
We configure the preview size right after Camera Manager is instantiated and SurfaceTexture
, where the preview gets rendered, is ready.