Android 包装内容大于实际图像视图
我有一个简单的问题,我有一个简单的Android 包装内容大于实际图像视图,android,xml,android-imageview,dpi,android-relativelayout,Android,Xml,Android Imageview,Dpi,Android Relativelayout,我有一个简单的问题,我有一个简单的RelativeLayout,带有一个ImageView(很快会添加更多)。但是,ImageView的宽度和高度设置为wrap\u content,但选中后,宽度正确对齐(可能是因为它是屏幕的最大宽度),但高度似乎比实际图像更宽。这些图像是通过Adobe Illustrator制作的,然后以.png格式输出,DPI为480 例如: <RelativeLayout xmlns:android="http://schemas.android.com/apk/r
RelativeLayout
,带有一个ImageView
(很快会添加更多)。但是,ImageView
的宽度和高度设置为wrap\u content
,但选中后,宽度正确对齐(可能是因为它是屏幕的最大宽度),但高度似乎比实际图像更宽。这些图像是通过Adobe Illustrator制作的,然后以.png格式输出,DPI为480
例如:
<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>
[由于rep<10,无法发布直接图像,但我想显示我的问题
为了更好地理解,请直接链接到图片]
问题是:
显示我的图像没有更大的边框:
但是,如果我将图像进一步向下移动,理论上包装的内容区域将被切断,那么它会根据我设置的边距值将自身的大小(高度)越来越小。
所以,如果有人知道它为什么会这样并能解释的话,那就太好了 这是一个老问题,但可能有人会偶然发现,所以我会留下一个答案 我也有同样的问题,设置
android:adjustViewBounds=“true”
对我有帮助。它使ImageView自身调整大小以适合图像