Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 安卓摄像头与透明图片重叠_Android_Image_Camera_Overlap - Fatal编程技术网

Android 安卓摄像头与透明图片重叠

Android 安卓摄像头与透明图片重叠,android,image,camera,overlap,Android,Image,Camera,Overlap,对于Android应用程序,我有一个小问题: 我需要拍一张照片,但我需要在相机显示屏上放一个透明的图像,就像重叠的一样 有不同的方法(但我不知道如何): 使用android摄像头 Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY,

对于Android应用程序,我有一个小问题: 我需要拍一张照片,但我需要在相机显示屏上放一个透明的图像,就像重叠的一样

有不同的方法(但我不知道如何):

  • 使用android摄像头

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
    intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
    activity.startActivityForResult(intent, Picture.CAMERA);
    
    对于这一点,我应该做任何事情,像开始这个意图透明,我的重叠图像将在下面

  • 在我的XML中包含相机,并执行我需要的更改,或者类似的操作

  • 从某处下载android摄像头的源代码,根据需要进行更改,并将我的应用程序商业化。(我不知道许可证是否允许我这样做)

  • 创建我自己的相机(这将是丑陋的,也是我最后的选择)

  • 好主意是受欢迎的

    致以最良好的祝愿

    我自己做过这件事——当时我找不到其他人做过。你不能依赖于摄像机的意图。我将使用的方法是使用相机预览,可以在类中编写,然后在框架布局中包含在xml中。在同一布局中包括全屏图像视图。需要对zorder等进行一些修改,尤其是在添加/删除图像时

    编写一个类来控制相机预览可能看起来令人望而生畏,但实际上非常简单,并且比简单地使用相机预览提供了更多的控制。有关更多信息,请参阅

    试着放平一点

    如下图所示:

    //main Layout first.xml

    setContentView(R.layout.preview_camera); 
    
    //另一个.xml文件

    controlInflater1 = LayoutInflater.from(getBaseContext());
         View viewControl1 = controlInflater.inflate(R.layout.frame_layout, null);
         LayoutParams layoutParamsControl1
          = new LayoutParams(LayoutParams.FILL_PARENT,
          LayoutParams.FILL_PARENT);
         this.addContentView(viewControl1, layoutParamsControl1);
    
    阅读文件,了解更多信息。这可能会有所帮助