Preview aspect ratio is different on different devices
<p>in my app I have a preview screen. On one device (LG, with Android 2.2, 320x480 screen) and another one (HTC, with Android 2.3, 480x800 screen) everything is OK. In both cases the list of supported preview sizes include one that fits the screen size exactly, I choose it and the image is perfect.
The problem comes with yet another device, having a screen similar to the first one (Samsung, Android 2.3, 320x480 screen). Regardless of the fact that I select a preview size that fits the screen size, as in previous cases, the image doe not preserve its aspect ratio; circles appear oval; the image is squeezed along the short axis of the screen. It seems the hardware itself, in order to obtain a 320x480 preview, squeezes the image (the camera has a form factor 4:3, while the screen has a form factor 3:2).
So I have altered the layout params of the view where the preview appears, in order to fit the form factor of the camera (size: 360x480. This PARTIALLY solves the problem; actually, to solve it completely I had to set 380x480 (!!!).
The fact is that I can't possibly find any API that tells me about this different behavior, so that I can automatically compensate for it. Not even the <a href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getHorizontalViewAngle%28%29" rel="nofollow">Camera.Parameters.getHorizontalViewAngle</a> and <a href="http://developer.android.com/reference/android/hardware/Camera.Parameters.html#getVerticalViewAngle%28%29" rel="nofollow">Camera.Parameters.getHorizontalViewAngle</a> seem to be helpful; they give the same values on all of the three devices!
Can anyone help me?</p>
