<CheckBox
android:id="@+id/checkbox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="复选框1"
/>
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="20dp"
android:text="按钮1"
/>
btn1 =(Button)findViewById(R.id.button1);
btn1.setOnClickListener(new Button.OnClickListener(){public void onClick(View arg0) {这里输入点击Button按钮触发的事件}});
CheckBox被选中或取消选中触发事件:
checkbox1=(CheckBox)findViewById(R.id.checkbox1);
b5.setOnCheckedChangeListener(new OnCheckedChangeListener(){if(checkbox1.isChecked()){这里输入CheckBox复选框选中时触发的事件}else{这里输入CheckBox复选框取消选中时触发的事件}});
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="20dp"
android:text="按钮1"
android:onClick="btnOnClick"
/>
public void btnOnClick(){
这里输入
点击Button按钮触发的事件
}
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有