添加一个Button按钮
#增加一个Button
1. 在layout下的xml中添加
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1" />
2. 在对应的Activity中添加:
Button Btn1 = (Button)findViewById(R.id.button1);
Btn1.setOnClickListener(new Button.OnClickListener() {//创建监听
public void onClick(View v) {
System.out.println("Hello Button!");
}
});
posted on 2017-11-17 15:44 dream_bccb 阅读(1131) 评论(0) 收藏 举报
浙公网安备 33010602011771号