我在layout中导入了需要的class
com.example.yeluo.demo.login.EventHandlers
并且在按钮中onClick使用了 @{handlers.doSubmit}
但是事件没有执行。。
各位大神请给小弟指点一下。
下面是相关代码
部分相关xml
<data>
<variable
name="handlers"
type="com.example.yeluo.demo.login.EventHandlers"/>
<variable
name="loginbeen"
type="com.example.yeluo.demo.login.LoginBeen"/>
</data>
<Button
android:id="@+id/login_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="@{handlers.doSubmit}"
android:text="@string/login_submit"/>
class
public class EventHandlers{
public void doSubmit (View view) {
Toast.makeText(view.getContext(), "you clicked the view", Toast.LENGTH_LONG).show();
}
}