android - How to exactly fit camera preview to the screen -


i need have portrait activity , actionbar , fill rest of screen camera preview. should not squeeze or strech image.

on devices ratio of screen not fit ratio of avilable camera outputs. action bar decreases available height, too.

for example, display size of sony xperia t2 ultra d5303 1208x720. however, avilable camera sizes given getsupportedpreviewsizes() are:

1200x1600 720x1280 720x960 480x720 480x640 320x480 288x352 240x320 144x176 

the optimal camera output (th 1 closest ratio) 720x1280. thus, camera preview not fill screen, there black blocks both on left , right.

is there way of filling screen without deteriorating image? (cropping top , bottom, perhaps)


Comments

Popular posts from this blog

javascript - oscilloscope of speaker input stops rendering after a few seconds -

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -