Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/194.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 SurfaceView顶部的ImageView_Android - Fatal编程技术网

Android SurfaceView顶部的ImageView

Android SurfaceView顶部的ImageView,android,Android,我有下面的布局 <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <com.example.linux.cam

我有下面的布局

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.example.linux.camtest.CameraPreview
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/camera_surfaceView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
         android:layout_centerVertical="true"/>


    <ImageView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/image"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:adjustViewBounds="true"
         />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/takePictureButton"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"/>

</RelativeLayout>

拍摄完图片后,我会执行image.setImageBitmap(位图),问题是图片显示在一个小区域中,而我已经将图像设置为与父对象匹配,并且我尝试填充父对象,但也不起作用

我需要的是将图像视图设置为与surfaceview相同的大小,这样当我拍摄照片并将其加载到imageview时,它将覆盖surfaceview

android:adjustViewBounds="true"

android:scaleType="fitXY"
到您的图像视图

删除

android:adjustViewBounds="true"

android:scaleType="fitXY"
到您的imageView