Android——单选多选按钮的使用详解

  • Post author:
  • Post category:其他


button1 = (Button) findViewById(R.id.button1);

button2 = (Button) findViewById(R.id.button2);

button1.setOnClickListener(this);

button2.setOnClickListener(this);

}

@Override

public void onClick(View v) {

Intent intent = new Intent();

switch (v.getId()) {

case R.id.button1:

//跳转页面

intent.setClass(MainActivity.this, RadioActivity.class);

startActivity(intent);

break;

case R.id.button2:

//跳转页面

intent.setClass(MainActivity.this, CheckActivity.class);

startActivity(intent);

default:

break;

}

}

}

activity_radio.xml

<LinearLayout xmlns:android=“http://schemas.android.com/apk/res/android”

xmlns:tools=“http://schemas.android.com/tools”

android:id=”@+id/LinearLayout1″

android:layout_width=“match_parent”

android:layout_height=“match_parent”

android:orientation=“vertical”

android:layout_margin=“20sp”

tools:context=”



r e l a t i v e P a c k a g e . {relativePackage}.







r


e


l


a


t


i


v


e


P







版权声明:本文为m0_64604178原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。