【发布时间】:2009-07-13 15:40:52
【问题描述】:
我将ImageView 和TextView 放在用作列表项的RelativeLayout 中,并希望ImageView 随着TextView 的行号垂直增长。 ImageView 的drawable 是一个垂直条的png图片。
使用以下布局,认为它在 Eclipse 的布局视图中看起来不错,ImageView 在运行时不会填充RelativeView 的高度。相反,它始终保持原始图片的高度。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:id="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:src="@drawable/vbar"
android:adjustViewBounds="false"
android:scaleType="fitXY"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="false"
android:layout_toRightOf="@id/iv"
android:layout_alignParentBottom="true" />
</RelativeLayout>
为什么它不像我期望的那样工作(或如 Eclipse 布局视图中所示)?
【问题讨论】:
-
如果你使用
android:background而不是android:src会改变什么吗?
标签: android eclipse android-imageview android-relativelayout