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