Android Eclipse给出错误,因为在使用R.layout.camera_surface时,无法解析camera_surface,或者camera_surface不是字段
我正在尝试访问Android中的摄像头以获取实时视频。我正在尝试将内容视图设置为Android Eclipse给出错误,因为在使用R.layout.camera_surface时,无法解析camera_surface,或者camera_surface不是字段,android,android-camera,Android,Android Camera,我正在尝试访问Android中的摄像头以获取实时视频。我正在尝试将内容视图设置为camera\u surface。但是,Eclipse给了我一个错误,因为相机曲面无法解析或不是字段 我的代码如下: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.camera_surface);
camera\u surface
。但是,Eclipse给了我一个错误,因为相机曲面无法解析或不是字段
我的代码如下:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.camera_surface);
surfaceView = (SurfaceView) findViewById(R.id.surface_camera);
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
谁能告诉我出了什么问题吗?问题是我需要在
res->layout
文件夹中创建一个名为camera\u surface.xml
的文件,这就解决了问题