我不想要 ImageView 和下面的 TextView 之间的(黑色)空间。我究竟做错了什么?感谢您的帮助。
<RelativeLayout
android:id="@+id/layout_contentView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/club_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/condition_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@id/club_banner"
android:background="@drawable/overview_cell_header_bg"
android:gravity="center_vertical"
android:paddingLeft="5dp"
android:text="@string/Condition_1"
android:textColor="#ffffff"
android:textSize="13sp"
android:textStyle="normal" />
最佳答案
问题是 firStart
使用 Matrix.ScaleToFit
中的 START
常量,它只会选择缩放图像 x 或 y轴
Compute a scale that will maintain the original src aspect ratio,
but will also ensure that src fits entirely inside dst. At least one
axis (X or Y) will fit exactly.
解决方法:
您需要使用 fitXY
来从 x 轴和 y 轴缩放图像
关于安卓布局问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25631371/