自定义Android摄像头:SquareCamera

jopen 9年前

介绍:

使用Camera api实现的相机程序。特点:触摸对焦,缩放,前置后置摄像头切换,闪光灯模式。界面很美观。

Features

  • Tap to focus
  • Two fingers zooming
  • Front & Back camera
  • Flash mode
private static final int REQUEST_CAMERA = 0;    // Start CameraActivity  Intent startCustomCameraIntent = new Intent(this, CameraActivity.class);  startActivityForResult(startCustomCameraIntent, REQUEST_CAMERA);    // Receive Uri of saved square photo  @Override  protected void onActivityResult(int requestCode, int resultCode, Intent data) {      if (resultCode != RESULT_OK) return;        if (requestCode == REQUEST_CAMERA) {          Uri photoUri = data.getData();      }      super.onActivityResult(requestCode, resultCode, data);  }

运行效果: