嵌套包括标签在Android XML布局中不起作用



我有以下相关性,称其为layout_dog

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/gray" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_horizontal"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:background="@color/white"
        android:orientation="vertical" >
        <TextView
            ... />
        <TextView
           ... />
    </LinearLayout>
    <include
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_gravity="center"
        layout="@layout/center_overlay" />
</RelativeLayout>

当我在 Graphical Layout中查看layout_dog时,一切都很好。

,但是我还有另一个布局文件,一个线性layout,称为layout_book。当我 include layout_dog内部layout_book中时,center_overlay不会在layout_book中显示。有人知道如何正确吗?

实际上没有Android的问题。我在layout_book

中包括错误的XML文件

最新更新