Android之布局onClick属性写法规则
16lz
2021-12-04
/** 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)
更多相关文章
- 浅谈Java中Collections.sort对List排序的两种方法
- Python list sort方法的具体使用
- python list.sort()根据多个关键字排序的方法实现
- Android(安卓)IntentService 分析
- android mediaplayer SurfaceView
- android mediaplayer SurfaceView
- canvas.drawRoundRect方法,绘制圆角矩形
- android java.util.ConcurrentModificationException
- Android(安卓)View绘制机制