/** 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)

相关文章:

  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2021-12-31
  • 2022-01-29
  • 2021-08-22
猜你喜欢
  • 2022-12-23
  • 2021-12-29
  • 2022-12-23
  • 2022-02-07
相关资源
相似解决方案