例子效果图:
实现步骤:
第一步:建立Android 工程:RadioGroupDemo。
第二步:编写Activity 的子类别:RadioGroupDemo,其程序代码如下:
package com.a3gs.radiogroup;
import android.app.Activity;
import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
public class RadioGroupDemo extends Activity {
private TextView TV;
private RadioGroup RG;
private RadioButton RB1, RB2;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
<