(android)设置背景后,ImageView变得更大

(android)设置背景后,ImageView变得更大,android,Android,当点击“btn_report_addImage1”时,应用程序调用相机功能拍照。然后,按钮消失,内部relativeLayout显示我拍摄的图片,并在图片的右上角显示remove按钮 问题是: 我将图像视图的宽度和高度设置为65dp。 但是当图片显示在imageView上时,图片会比以前更大 <LinearLayout android:layout_width="match_parent" android:layout_height="65dp"

当点击“btn_report_addImage1”时,应用程序调用相机功能拍照。然后,按钮消失,内部relativeLayout显示我拍摄的图片,并在图片的右上角显示remove按钮

问题是: 我将图像视图的宽度和高度设置为65dp。 但是当图片显示在imageView上时,图片会比以前更大

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="65dp"
        android:orientation="horizontal">


        <RelativeLayout
            android:layout_width="65dp"
            android:layout_height="match_parent">
            <Button
                android:id="@+id/btn_report_addImage1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
               />
            <RelativeLayout
                android:id="@+id/layout_report_image1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone" >

                <ImageView
                    android:id="@+id/image_report_image1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY"/>
                <Button
                    android:id="@+id/btn_report_removeImage1"
                    android:layout_width="35dp"
                    android:layout_height="25dp"
                    android:layout_alignParentRight="true"
                    android:text="-"
                    android:textSize="5dp"
                  />
            </RelativeLayout>
        </RelativeLayout>


        <RelativeLayout
            android:layout_width="65dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="5dp">
            <Button
                android:id="@+id/btn_report_addImage2"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
            <RelativeLayout
                android:id="@+id/layout_report_image2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone">

                <ImageView
                    android:id="@+id/image_report_image2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:scaleType="fitXY"/>
                <Button
                    android:id="@+id/btn_report_removeImage2"
                    android:layout_width="35dp"
                    android:layout_height="25dp"
                    android:layout_alignParentRight="true"/>
            </RelativeLayout>
        </RelativeLayout>


您已将scaleType指定为fitXY。这就是原因
android:scaleType=“fitXY”
缩放图像以适应我们称之为
fitXY
的两个轴上的视图,在您的情况下,您已经定义了图像的
l*b
,因此删除
scaleType=fitXY

               <ImageView
                android:id="@+id/image_report_image1"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
                // scaleType removed

//去除鳞片

您可以将ImageView缩放类型设置为“centerCrop”

        <ImageView
        android:id="@+id/image_report_image1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop" />

尝试在src中添加实用的图像。因此,您可以获得适当的图像大小和显示正确