码迷,mamicode.com
首页 > 移动开发 > 详细

Android之布局onClick属性写法规则

时间:2015-11-30 17:21:50      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

/** Called when the user clicks the Send button */
public void sendMessage(View view) {
    // Do something in response to button
}

In order for the system to match this method to the method name given to android:onClick, the signature must be exactly as shown. Specifically, the method must:

  • Be public //一定是public的方法
  • Have a void return value //一定是无返回值的方法
  • Have a View as the only parameter (this will be the View that was clicked) //有且只有一个View类型的形参(希望被点到的View)

Android之布局onClick属性写法规则

标签:

原文地址:http://www.cnblogs.com/bvin/p/5007428.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!