添加一个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!");
        }
    });
相关文章
相关标签/搜索