`

Radio

 
阅读更多
 <RadioGroup
        android:id="@+id/radGroup"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <RadioButton
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="@string/rad1" />

        <RadioButton
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="@string/rad2" />

        <RadioButton
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="@string/rad3" />
    </RadioGroup>
	
	 RadioGroup radGroup = (RadioGroup)findViewById(R.id.radGroup);
     radGroup.setOnCheckedChangeListener(radioListen);
	 
	 private android.widget.RadioGroup.OnCheckedChangeListener radioListen = new android.widget.RadioGroup.OnCheckedChangeListener() {
		@Override
		public void onCheckedChanged(RadioGroup group, int checkedId) {
			// TODO Auto-generated method stub
			Toast.makeText(TextViewActivity.this, checkedId+"选中", Toast.LENGTH_SHORT).show();
		}
	};

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics