Frage

Is there any possibility to achieve full screen camera preview using CWAC-camera? Because now I am getting this:

enter image description here

Even without actionbar there are thiner blank lines.

War es hilfreich?

Lösung

Right now, the aspect ratio of the preview needs to match the aspect ratio of the picture that you are going to take, otherwise your pictures get stretched or squashed.

If I find a workaround for that, then perhaps you will be able to get edge-to-edge previews. Right now, the preview automatically changes its aspect ratio.

Andere Tipps

@Geralt_Encore

if you still want it to be fill screen then you should make some changes in onLayout() method of CameraView

comment the below code

 if (width * previewHeight > height * previewWidth) {
        final int scaledChildWidth=
            previewWidth * height / previewHeight;
        child.layout((width - scaledChildWidth) / 2, 0,
                     (width + scaledChildWidth) / 2, height);
      }
      else {
        final int scaledChildHeight=
            previewHeight * width / previewWidth;
        child.layout(0, (height - scaledChildHeight) / 2, width,
                     (height + scaledChildHeight) / 2);
      }

and add this line instead of above code

child.layout(l,t,r,b);

and you are done. now you will get full screen preview it will work but i haven't tested it with orientation changes because i Want my Camera Activity to be in portrait mode only.

hope this will help you

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top