Android 传递给<;包括>;布局不显示

Android 传递给<;包括>;布局不显示,android,data-binding,Android,Data Binding,我包含了一个布局,并使用app:variable name传递数据,但看不到结果。变量名在要包含的布局中定义。我将数据传递到布局的方式是否不正确 <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"

我包含了一个布局,并使用app:variable name传递数据,但看不到结果。变量名在要包含的布局中定义。我将数据传递到布局的方式是否不正确

<?xml version="1.0" encoding="utf-8"?>
<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools" >
        <LinearLayout
            android:layout_width="match_parent" 
            android:layout_height="match_parent"
            android:orientation="vertical"
            tools:context=".AboutFragment">

            <include
                android:id="@+id/dev1"
                layout="@layout/include_dev_credit"
                app:pic="@{@drawable/dev1}"
                app:name="@{@string/dev1}"
                app:role="@{@string/dev1}"
            />

    </LinearLayout>
</layout>

这是要包含的布局。它包含一个要膨胀的图像视图和两个文本视图。这里定义了数据变量

<?xml version="1.0" encoding="utf-8"?>
<layout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
>

    <data>

        <variable
                name="name"
                type="String"/>

        <variable
                name="role"
                type="String"/>

        <variable
                name="pic"
                type="android.graphics.drawable.Drawable"/>

    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal" android:paddingBottom="8dp">

            <ImageView
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_gravity="center"
                    android:scaleType="centerCrop"
                    android:src="@{pic}"/>

        <TextView
                android:id="@+id/nameView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="16dp"
                android:layout_marginEnd="16dp"
                android:paddingTop="8dp"
                android:text="@{name}"
                android:ems="8"
                android:textAlignment="center"
                android:textAppearance="@style/TextAppearance.AppCompat.Large"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintHorizontal_bias="0.5"
                app:layout_constraintStart_toEndOf="@+id/picView"
                app:layout_constraintTop_toTopOf="parent"/>

        <TextView
                android:id="@+id/roleView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginStart="16dp"
                android:layout_marginTop="4dp"
                android:layout_marginEnd="16dp"
                android:ems="10"
                android:textAlignment="center"
                android:text="@{role}"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium"
                app:layout_constraintEnd_to`enter code here`EndOf="parent"
                app:layout_constraintStart_toEndOf="@+id/picView"
                app:layout_constraintTop_toBottomOf="@+id/nameView"/>

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>