Android 添加按钮

layout.xml文件

<!-- 添加返回登录界面的按钮 -->

<Button android:id="@+id/back" android:layout_width="wrap_content"

android:layout_height="wrap_content" android:text="@string/back"/>

Layout.java文件

Button back = (Button)findViewById(R.id.back);
back.setOnClickListener(this);


@Override //按钮实现事件
public void onClick(View arg0) {
Intent intent = new Intent(SystemSettingAct.this ,LoginActivity.class);
startActivity(intent);

}

你可能感兴趣的:(android)