I'm not able to make a View
that fill the height of a RelativeLayout
, which is the layout of ListView
items. Here is my layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<View
android:id="@+id/fill_the_height_please"
android:layout_width="15dp"
android:layout_height="match_parent"
android:background="@color/red"/>
<TextView
android:id="@+id/delivery_list_item_dest"
android:layout_width="wrap_content"
android:layout_toRightOf="@id/fill_the_height_please"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp"
android:text="Destinatario" />
<TextView
android:id="@+id/delivery_list_item_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/delivery_list_item_dest"
android:layout_below="@id/delivery_list_item_dest"
android:layout_marginTop="5dp"
android:layout_marginRight="5dp"
android:text="Location" />
<ImageButton
android:id="@+id/delivery_list_item_mapBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="0dp"
android:src="@drawable/map_location"
android:background="@null" />
View with id fill_the_height_please not fill the item height. In figure below you can see the result (nothing is shown):
I'd like something like this:
ù
I have also try to change view layout as follows but not works anyway:
<View
android:id="@+id/fill_the_height_please"
android:layout_width="15dp"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:background="@color/red"/>
Please can you help to achieve my goal? Thank you.
One suggestion would be add layout_alignTop="@+id/delivery_list_item_mapBtn" and layout_alignBottom="@+id/delivery_list_item_mapBtn" to the View and make it always fit the image height.