Android 如何用相机拍摄图像并在其上放置图像视图?
有没有办法做到这一点?我遵循了这个教程(),效果非常好。此外,我将FrameLayout(包含摄影机预览)放入带有ImageView的RelativeLayout中Android 如何用相机拍摄图像并在其上放置图像视图?,android,camera,imageview,Android,Camera,Imageview,有没有办法做到这一点?我遵循了这个教程(),效果非常好。此外,我将FrameLayout(包含摄影机预览)放入带有ImageView的RelativeLayout中 <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" > <FrameLayout android:id="@+id/preview"
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<FrameLayout
android:id="@+id/preview"
android:layout_width="330dp"
android:layout_height="233dp"
android:layout_marginTop="22dp"
android:layout_alignBottom="@+id/imageView1"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" >
</FrameLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image_on_preview" />
</RelativeLayout>
现在启动应用程序,我有了摄像头和图像视图。如果我将图片保存到SD卡,我只会得到用相机拍摄的图片,但imageview不会出现(当然,为什么会出现)。现在我的问题是,我怎样才能保存它呢?
为了更好地理解,我在使用应用程序时捕获了一个屏幕截图
因此,我想在一张图片中同时保存相机预览和图像视图。我不确定这是否可行,但如果我不必将图片保存到sd卡上,那将是最好的。稍后我会添加一个按钮“保存到SD卡”来保存它
**更新
现在我想出了一个办法。我将图片保存在SD卡上,然后当创建文件时,我将更改为另一个目的。它包含两个图像视图,一个是“图像预览”,另一个是我之前保存图片的源代码。好吧,现在我只需要想办法把两个ImageView结合起来:)
***更新2
好的,我做到了。在第二个活动中,我将两个ImageView转换为位图。然后我画一张画布,它把它们放在一起,然后我可以直接保存到SD卡上。因为没有人回答,我解决了问题(并且有一票赞成),我展示了我自己的方法
canvas.drawBitmap()
。我首先绘制了捕获的照片,而不是imageview(封面),然后放置/缩放它们,使其看起来与活动中的一样。画布将绘制位图,您可以将其保存到sd卡。
5*(可跳过)删除第一张图片