【发布时间】:2014-08-05 16:02:17
【问题描述】:
我正在按照 google 的 android 开发者指南来创建相机捕捉应用程序。 http://developer.android.com/guide/topics/media/camera.html
我创建了 CameraPreview 类来显示来自相机的实时图像。然后将相机连接到它,如下所示
// Create an instance of Camera
mCamera = getCameraInstance();
// Create our Preview view and set it as the content of our activity.
mPreview = new CameraPreview(this, mCamera);
FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview);
preview.addView(mPreview);
在示例中,当用户按下按钮时单击图像,如下所示:-
Button captureButton = (Button) findViewById(id.button_capture);
captureButton.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
// get an image from the camera
mCamera.takePicture(null, null, mPicture);
}
}
);
我能否以某种方式将触摸监听器设置为相机预览(屏幕),这样当用户触摸屏幕时,我可以获得触摸的坐标,然后进行单独的处理??
【问题讨论】:
标签: android