android為RadioButton單獨添加checked監聽事件 – Android移動開發技術文章_手機開發 Android移動開發教學課程

 

final RadioButton red_radio = (RadioButton) findViewById(R.id.red_radio);  

        final RadioButton gray_radio = (RadioButton) findViewById(R.id.gray_radio);  

        gray_radio.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {  

            @Override 

            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {  

                red_radio.setChecked(false);  

            }  

        }); 

 

摘自 guying1028

發佈留言