我有一个简单的问题,我有一个简单的
示例:
RelativeLayout
,里面只有一个ImageView
(很快会添加更多)。然而,ImageView
的宽度和高度设置为wrap_content
,但是在检查时,宽度已经正确对齐(可能是因为它是屏幕的最大宽度),但是高度似乎比实际图像包裹得更多。这些图像是通过Adobe Illustrator制作的,然后以480 DPI的分辨率导出为.png文件。示例:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
tools:context=".MainActivity"
android:background="#d1070707">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/outer_shell"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:src="@drawable/out_shell" />
</RelativeLayout>
问题描述:http://postimg.org/image/75ijbo1zv/
展示我的图片没有更大的边框:http://postimg.org/image/mog8ijghb/
然而,如果我将图像向下移动到理论上会被裁剪的包裹内容区域,它会自动调整大小(高度),具体取决于我设置的边距值。所以,如果有人知道它为什么会这样,并且能够解释一下,那就太好了!