Eclipse使用R.layout.camera

编程入门 行业动态 更新时间:2024-10-24 22:29:30
Eclipse使用R.layout.camera_surface时无法解析camera_surface或不是字段时出错(Eclipse gives error as camera_surface cannot be resolved or is not a field while using R.layout.camera_surface)

我正在尝试访问Android中的相机以获取实时视频。 我正在尝试将我的内容视图设置为camera_surface 。 但是,Eclipse给出了错误,因为camera_surface cannot be resolved or is not a field

我的代码如下:

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); }

有谁能说出什么问题?

I am trying to access the camera in Android to get the live video. I am trying to set my Content View to camera_surface. However, Eclipse gives me error as camera_surface cannot be resolved or is not a field

My code is as follows:

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); }

Could anyone tell what is wrong?

最满意答案

问题是我需要在camera_surface.xml res->layout文件夹中创建一个名为camera_surface.xml的文件,这样才能解决问题。

The problem was that I needed to create a file called camera_surface.xml in the res->layout folder and that solved the problem.

更多推荐

本文发布于:2023-07-23 00:45:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1225135.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Eclipse   layout   camera

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!