tags:

views:

477

answers:

1

I put an ImageView and a TextView within a RelativeLayout that is used as list items, and want the ImageView to grow vertically with the line number of TextView. The drawable of the ImageView is a png picture of vertical bar.

With the following layout, thought it looks fine in the Layout view in Eclipse, the ImageView does not fill the height of the RelativeView at runtime. Instead, it alway keeps the original picture's height.

<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>

Why does it not work as I expect(or as shown in Eclipse Layout view)?

A: 

it seems fitXY does not shrink ?

rzr