多个数据绑定错误



每当我重建项目时,我都会收到这个错误

****/ data binding error ****msg:Multiple binding data tags in 
C:UsersTaiAndroidStudioProjectsRxjava2Practice2 - 
Copyappsrcmainreslayoutitem_movie.xml. Expecting a maximum of one.
file:C:UsersTaiAndroidStudioProjectsRxjava2Practice2 - 
Copyappsrcmainreslayoutitem_movie.xml
**** data binding error ****

有时ItemMovieBinding不会像往常一样自动生成,但在我重新启动android工作室后,它又可以正常工作了。

这是我的item_movie.xml,我确实尝试过清理和重建或重新启动android工作室,但什么都不起作用

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:bind="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="result"
type="com.example.tai.rxjava2practice2.Model.Result"></variable>
</data>
<data>
<variable
name="image"
type="com.example.tai.rxjava2practice2.Model.Image"></variable>
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_MovieName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_Avatar"
android:layout_weight="1"
android:text="@{result.title}"
android:textSize="16dp" />
<TextView
android:id="@+id/tv_ReleaseDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_Avatar"
android:layout_weight="1"
android:gravity="right"
android:text="@{result.releaseDate}"
android:textSize="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iv_Avatar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:src="@{image.imageUrl}" />
</LinearLayout>
</LinearLayout>

提前感谢:D

您应该只使用以下中的一个数据标记

<data>
<variable
name="result"
type="com.example.tai.rxjava2practice2.Model.Result"></variable>
<variable
name="image"
type="com.example.tai.rxjava2practice2.Model.Image"></variable>
</data>

相关内容

最新更新