SurfaceView顶部的ImageView

时间:2016-02-05 14:47:25

标签: 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.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(位图),问题是图片显示在一个小区域,而我已经将图像设置为match_parent,我尝试了fill_parent并且没有工作还

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

1 个答案:

答案 0 :(得分:0)

删除

android:adjustViewBounds="true"

并添加

android:scaleType="fitXY"

到你的imageView

相关问题