How to make a resolution independent camera preview on android?
Posted
by
histeria
on Stack Overflow
See other posts from Stack Overflow
or by histeria
Published on 2010-12-21T00:23:05Z
Indexed on
2010/12/21
23:54 UTC
Read the original article
Hit count: 185
Hi all, I'm making an android 1.6 app that uses phone's camera.
In order to do this app resolution independent, I need to set a compatible aspect ratio for previewing camera on a SurfaceLayout. In 1.6 sdk there is no way to get supported sizes for the camera preview. It is possible to use a 4:3 or 3:2 aspect ratio and get no errors whith that?
On the other hand, I need a way to make a xml layout that represents this Surfacelayout in this (unknown) aspect ratio in every resolution. I assume that is not possible to change the SurfaceLayout size in runtime. Can I do it with "dp" units? The other way is making this layout programmatically?
There are some apps like Vignette or android camera application with some tricks to make something like that, like black bars (vignette) or fixed buttons bar, but I don't know how to do it in any kind of resolution.
Any ideas?
Thanks!
© Stack Overflow or respective owner