问题描述
我需要相机出现在这里的android特定的屏幕面积是code,我用相机活动
现在摄像头的工作,但它占据整个屏幕,我想相机出现在屏幕的particulat面积如何做到这一点?
私人无效uploadPhoto(字符串名称){
意向意图=新意图(MediaStore.ACTION_IMAGE_CAPTURE);
档案文件=新的文件(Environment.getExternalStorageDirectory(),名称
+.JPG);
mImageCaptureUri = Uri.fromFile(文件);
尝试{
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
mImageCaptureUri);
intent.putExtra(回归数据,真正的);
startActivityForResult(意向,PICK_FROM_CAMERA);
}赶上(例外五){
e.printStackTrace();
} }
您不能使用此意图。如果您使用的意图,它西港岛线启动相机应用。相反,你需要使用一种叫做相机preVIEW。这将显示摄像头看到用户什么,然后你可以使用API的控制摄像头的动作。
在这里是一个非常好的教程,这从官方开发人员文档:
I need camera to appear in particular screen area in android here is the code that I use for camera activity
Now camera is working but it occupies whole screen I want camera to appear in particulat area of screen how to do this??
private void uploadPhoto(String name) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = new File(Environment.getExternalStorageDirectory(), name
+ ".jpg");
mImageCaptureUri = Uri.fromFile(file);
try {
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
mImageCaptureUri);
intent.putExtra("return-data", true);
startActivityForResult(intent, PICK_FROM_CAMERA);
} catch (Exception e) {
e.printStackTrace();
}
}
You cannot use an intent for this. If you use an intent, it wil launch the camera app. Instead, you need to use something called a Camera Preview. This will show what the camera sees to the user and you can then use API's to control the camera actions.
here is a very nice tutorial for this from the official developer docs:https://developer.android.com/guide/topics/media/camera.html#custom-camera
这篇关于如何使相机出现在特定的屏幕区域的Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!