Android camera rotate

前端 未结 6 715
鱼传尺愫
鱼传尺愫 2020-11-30 06:04

I have a Motorola Defy OS Android 2.1 and I make an application with camera Preview. The problem is that the camera works fine on Samsung Galaxy S with Android 2.1, but on M

6条回答
  •  执笔经年
    2020-11-30 06:38

    if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
            camera.setDisplayOrientation(90);
            lp.height = previewSurfaceHeight;
            lp.width = (int) (previewSurfaceHeight / aspect);
        } else {
            camera.setDisplayOrientation(0);
            lp.width = previewSurfaceWidth;
            lp.height = (int) (previewSurfaceWidth / aspect);
        }
    

提交回复
热议问题