2016-02-05 50 views
1
的頂部

我有以下佈局,的ImageView上SurfaceView

<?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

回答

0

刪除

android:adjustViewBounds="true" 

,並添加

android:scaleType="fitXY" 

您的ImageView