DataBinding is Google's latest technology
For the binding of events, take the onclick of the button as an example:
1) Define the Click event Model:
<layout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http://schemas.android.com/ Tools > <data> <variable name= "result" type= "Cn.xinyi.com.demo1.module.Result" /> <variable name= "handler" type= "Cn.xinyi.com.demo1.handler.LoginHandler"/> < /data>
Loginhandler is the event model for the login button
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/7F/3C/wKiom1cXQNiR-yc1AAISniEHrYU103.png "title=" Qq20160420163643.png "alt=" Wkiom1cxqnir-yc1aaisniehryu103.png "/>
2) binding view and model in activity
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/7F/3C/wKiom1cXQX_w4IgiAACQSAMI_xA183.png "title=" Qq20160420164504.png "alt=" Wkiom1cxqx_w4igiaacqsami_xa183.png "/>
In fact, the above callback can fully use the network request client callback, do not need to customize, a bit redundant.
This article is from the "line of the World" blog, please be sure to keep this source http://4259297.blog.51cto.com/4249297/1765850
DataBinding first Knowledge