在Android Studio的数据绑定库中找不到setHandler的符号方法

在Android Studio的数据绑定库中找不到setHandler的符号方法,android,android-studio,android-studio-2.2,android-databinding,Android,Android Studio,Android Studio 2.2,Android Databinding,我正在android studio中使用数据绑定库,并创建了处理程序来检测onlcik()事件,我正在使用以下代码 main_activity.xml <?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"

我正在android studio中使用数据绑定库,并创建了处理程序来检测
onlcik()
事件,我正在使用以下代码

main_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<layout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <data>
        <variable
            name="handlers"
            type="com.example.MainActivity.MyHandlers"/>
    </data>
        <RelativeLayout
            android:orientation="vertical"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:layout_width="wrap_content"
            android:layout_height="match_parent">


                <include
                        android:layout_height="wrap_content"
                        layout="@layout/grid_layout_carinfo"
                        app:includedViewGroup="@{1}"
                        bind:handlers="@{handlers}"
                        android:layout_width="wrap_content"/>

    </RelativeLayout>
</layout>
<layout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">
    <data>

        <variable
            name="handlers"
            type="com.example.MainActivity.MyHandlers"/>
        <variable
            name="includedViewGroup"
            type="int"/>
    </data>

    <GridLayout
        android:id="@+id/GridLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:columnCount="3"
        android:rowCount="4"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="@dimen/driver_info_view_margin"
            android:layout_marginRight="@dimen/driver_info_view_margin"
            android:layout_column="0"
            android:layout_row="0">

            <ImageView
                    android:id="@+id/car_photo_front_view"
                    android:src="@mipmap/abc"
                    android:layout_marginTop="8dp"
                    android:onClick="@{(view)->handlers.onCarPhotoFrontView(view)}"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    tools:ignore="ContentDescription" />


        </LinearLayout>
    </GridLayout>
</layout>
当我尝试构建项目时,我得到了错误

Error:(134, 29) error: cannot find symbol method setHandler(MainActivity.MyHandlers)

搜索后,我找到了答案,即
bind:handlers=“@{handlers}”
中的名称必须与
data
标记中包含的视图中使用的名称相同,请清理并重建项目,然后它就可以工作了

Error:(134, 29) error: cannot find symbol method setHandler(MainActivity.MyHandlers)