您正在使用相机应用程序,这不适合您的目的。因为你不能覆盖相机应用上的任何对象。你只能从它得到一个图像。所以你必须创建你的内置相机应用程序,并将其用于你的目的。 我带一个使用内置相机的例子。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<SurfaceView android:id="@+id/CameraView" android:layout_width="fill_parent"
android:layout_height="fill_parent"></SurfaceView>
</LinearLayout>
现在创建活动像这样实现SurfaceHolder.Callback
import android.app.Activity;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
public class SnapShot extends Activity implements SurfaceHolder.Callback {
SurfaceView cameraView;
SurfaceHolder surfaceHolder;
Camera camera;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
cameraView = (SurfaceView) this.findViewById(R.id.CameraView);
surfaceHolder = cameraView.getHolder();
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
surfaceHolder.addCallback(this);
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
}
public void surfaceCreated(SurfaceHolder holder) {
camera = Camera.open();
try
{
camera.setPreviewDisplay(holder);
}
catch (IOException exception)
{
camera.release();
}
camera.startPreview();
}
public void surfaceDestroyed(SurfaceHolder holder) {
}
}
这是不可能的。经纬度由相机应用程序控制。如果你想设置它们,你可以自己实现相机应用程序,而不是调用系统相机应用程序 – yushulx