Android中如何在布局文件中为组件绑定点击事件?
闭关修行中......
Add the onClick="name" attribute to the component in the layout file. The "name" can be arbitrary, as long as it corresponds to the class
Then in the class public void name(View view) {
System.out.println("我被点击了!");
}
Write your click logic in this function
Add the onClick="name" attribute to the component in the layout file.
The "name" can be arbitrary, as long as it corresponds to the class
Then in the class
public void name(View view) {
}
Write your click logic in this function