将视图添加到LinearLayout时,Android match\u父对象不更改高度

将视图添加到LinearLayout时,Android match\u父对象不更改高度,android,android-layout,Android,Android Layout,我有一个ListView,其中的项目可能包含不同的行数和几个键:值字段。所以我在适配器的getView中添加了LinearLayout和lines 现在我想在列表项的右侧垂直居中绘制一个箭头> 以下是我的布局: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/ListItemContainerBase" android:layout_width=

我有一个ListView,其中的项目可能包含不同的行数和几个键:值字段。所以我在适配器的getView中添加了LinearLayout和lines

现在我想在列表项的右侧垂直居中绘制一个箭头>

以下是我的布局:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/ListItemContainerBase"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?activatableItemBackground"
    android:baselineAligned="true"
    android:orientation="horizontal" >

    <LinearLayout
        android:id="@+id/list_item_middle_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:orientation="vertical" >
    </LinearLayout>

    <RelativeLayout
        android:id="@+id/arrow_container"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_alignParentRight="true"
        android:layout_centerHorizontal="true"
        android:background="#bbbbbb" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:padding="8dip"
            android:src="@drawable/arrow" />
    </RelativeLayout>

</RelativeLayout>
现在我的问题是: 将视图添加到列表项容器后,箭头容器未调整大小。 它仅包裹ImageView,但不填充父高度。 我尝试调用requestLayout并打开/关闭可见性,但没有结果。
谢谢

这是我对一个类似问题的回答