lit*_*end 1 java data-binding android android-layout
每当我重建项目时,我都会不断收到此错误
****/ data binding error ****msg:Multiple binding data tags in
C:\Users\Tai\AndroidStudioProjects\Rxjava2Practice2 -
Copy\app\src\main\res\layout\item_movie.xml. Expecting a maximum of one.
file:C:\Users\Tai\AndroidStudioProjects\Rxjava2Practice2 -
Copy\app\src\main\res\layout\item_movie.xml
****\ data binding error ****
Run Code Online (Sandbox Code Playgroud)
有时ItemMovieBinding
也不会像往常一样自动生成,但是在我重新启动android studio之后,它又可以正常工作了。
这是我的item_movie.xml
,我确实尝试清理并重建或重新启动android studio,但根本没有任何效果
<?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>
Run Code Online (Sandbox Code Playgroud)
先谢谢了
您应该只使用一个数据标签,如下所示
<data>
<variable
name="result"
type="com.example.tai.rxjava2practice2.Model.Result"></variable>
<variable
name="image"
type="com.example.tai.rxjava2practice2.Model.Image"></variable>
</data>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
336 次 |
最近记录: |