【发布时间】:2016-05-30 13:57:00
【问题描述】:
这是我的情况,我有一个这样的图像视图:
你能看到我的“+”符号不在我的“没有头像”图片的末尾,那是因为这张图片没有填满它的 imageView。
我已经尝试过 android:adjustViewBounds="true" 和 android:scaleType="fitXY" 就像在 Unwanted padding around an ImageView 中所说的那样,但它对我不起作用。
有什么想法吗?
编辑:
我忘记了我的布局:
<RelativeLayout
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_marginTop="10dp"
android:id="@+id/iv_profile_picture"
android:layout_width="140dp"
android:layout_height="140dp"
android:adjustViewBounds="true"
android:src="@mipmap/ic_no_image_profile"
/>
<ImageButton
android:src="@mipmap/ic_new_image_profile"
android:background=""
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignRight="@+id/iv_profile_picture"
android:layout_alignEnd="@+id/iv_profile_picture"
android:layout_alignBottom="@+id/iv_profile_picture"/>
</RelativeLayout>
【问题讨论】:
-
如果您使用任何类型的图像加载器库,请确保它没有覆盖您在 xml 布局中设置的比例类型
-
@MuchOverflow 我想我没有使用任何库来加载图像
-
你应该使用drawable文件夹来放置你的图片文件。 mipmap 文件夹应仅用于放置应用启动器图标文件。参考这个:stackoverflow.com/a/28065664/3533289我认为这可能是问题
-
可能是您的图片包含填充。
-
@umerk44 我不这么认为,我尝试了其他图像,我得到了相同的结果:(
标签: android imageview android-imageview