preview stretches in camera2 apis

前端 未结 4 1432
别那么骄傲
别那么骄傲 2021-02-12 23:18

Following are the screenshots when using texture view in camera2 apis.In full screen the preview stretches,but it works when using lower resolution(second image). How to use thi

4条回答
  •  一生所求
    2021-02-12 23:34

    I figured out what was your poroblem. You were probably trying something like this:

    textureView.setSurfaceTextureListener(new TextureView.SurfaceTextureListener() {
        @Override
        public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int j) {
            cam.startPreview(surfaceTexture, i, j);
            cam.takePicture();
        }
    
        public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i1) { }
        public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) { return false; }
        public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) { }
    });
    

提交回复
热议问题