Android之布局onClick属性写法规则
16lz
2021-01-23
/** 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 toandroid: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 theView
that was clicked) //有且只有一个View类型的形参(希望被点到的View)
更多相关文章
- canvas.drawRoundRect方法,绘制圆角矩形
- android抓log方法
- android 登陆右上角 的关闭按钮的使用方法
- Android AESUtils 工具类与调用方法
- Android Gson类型转换错误解决 com.google.gson.internal.Linked
- sqlit导入外部数据库查找数据方法
- Android NDK打印log到logcat的方法
- Android获取系统时间的多种方法
- Android链式方法显示Dialog