How to get an Android Camera2 with 1:1 ratio like Instagram?

前端 未结 4 1625
渐次进展
渐次进展 2021-02-13 14:21

My question is very simple:

How to get an Android android.hardware.Camera2 with 1:1 ratio and without deformation like Instagram?

4条回答
  •  不知归路
    2021-02-13 15:01

    I did it with the Layout, in that way, google code can be keeped as it comes and automatically set a 1:1 preview based on the UI.

        
    
        
    
    
    

    Just put the AutoFitTextureView inside a ConstraintLayout and then

    previewSize = chooseOptimalSize(map.getOutputSizes(SurfaceTexture.class), width, height, videoSize); does all the magic

提交回复
热议问题