Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.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 - Fatal编程技术网

Android 图片大小和相机预览大小问题

Android 图片大小和相机预览大小问题,android,image,camera,Android,Image,Camera,我正在使用相机预览制作相机应用程序。预览在2.5权重的框架布局中,权重总和为4: <LinearLayout ... //some xml android:weightSum="4" > <FrameLayout android:id="@+id/camera_preview" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weig

我正在使用相机预览制作相机应用程序。预览在2.5权重的框架布局中,权重总和为4:

<LinearLayout ...
//some xml

android:weightSum="4" >

<FrameLayout
    android:id="@+id/camera_preview"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="2.5"
    android:background="#000000" >

</FrameLayout>

但当我拍照时,照片显示的细节比框架布局重量更多,如下所示:

相机预览看起来像:

捕获的图片看起来像:


问题是如何使捕获的图像看起来像预览中显示的图像?

您的预览显示了您设置的显示内容,但相机似乎拍摄了整个图像。您应该能够缩放/剪切/等图片以匹配预览,或者您可能希望以其他方式设置相机预览,如Android文档中所述:

卡迈尔