Android 查看韩元';布局充气时不显示

Android 查看韩元';布局充气时不显示,android,android-layout,android-view,Android,Android Layout,Android View,下面是我的list_section.xml代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="1dp" android:background="@color/colorBackgrou

下面是我的list_section.xml代码:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="1dp"
android:background="@color/colorBackgroundDark"
android:paddingBottom="10dp"
android:paddingTop="10dp">

<TextView
    android:id="@+id/textViewAssessmentTypeName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="left"
    android:paddingLeft="16dp"
    android:textColor="@color/colorPrimaryText" />

<View
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#8000FF00" />
</RelativeLayout>

但由于某些原因,layout.xml中的视图(我正在使用它作为RelativeLayout上的颜色过滤器/覆盖)不会显示。可能是什么问题?

我通过将list_section.xml更改为:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/colorBackgroundDark">

<TextView
    android:id="@+id/textViewAssessmentTypeName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:gravity="left"
    android:paddingLeft="16dp"
    android:textColor="@color/colorPrimaryText" />

<View
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#8000FF00" />
</RelativeLayout>

上一个不起作用,因为RelativeLayout的布局高度最终为0

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@color/colorBackgroundDark">

<TextView
    android:id="@+id/textViewAssessmentTypeName"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:gravity="left"
    android:paddingLeft="16dp"
    android:textColor="@color/colorPrimaryText" />

<View
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#8000FF00" />
</RelativeLayout>