我创建曲面的代码是:
public void surfaceCreated(SurfaceHolder arg0){
// TODO Auto-generated method stub
if (camera == null) {
try {
Log.e("camera starting","camera starting");
camera = android.hardware.Camera.open();
Camera.Parameters parameters = camera.getParameters();
//final List<String> coloreffects = camera.getParameters().getSupportedColorEffects();
mParameters.set("rotation","ANTIBANDING_60HZ");
parameters.setFocusMode(Camera.Parameters.EFFECT_SEPIA);
parameters.getFocusMode();
mParameters.set("rotation",90);
parameters.setFocusMode("android.intent.extra.focus");
Intent intent = new Intent("android.intent.extra.focus");
startActivityForResult(intent, 0);
camera.setParameters(parameters);
Log.e("camera running","camera runnng");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
最佳答案
使用此代码。并更改avd 2.2版
@Override
public void surfaceCreated(SurfaceHolder holder) {
camera = Camera.open();
try {
camera.setPreviewDisplay(holder);
Camera.Parameters parameters = camera.getParameters();
parameters.setPictureFormat(PixelFormat.JPEG);
parameters.set("orientation", "portrait");
camera.setDisplayOrientation(90);
parameters.setRotation(90);
camera.setParameters(parameters);
}
catch (IOException exception) {
camera.release();
}
}
关于android - 当我启动相机时,其表面刚好相对,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6288779/