其他分享
首页 > 其他分享> > 单选框弹出提示框

单选框弹出提示框

作者:互联网

 1 private RadioGroup mrg1;
 2     @Override
 3     protected void onCreate(Bundle savedInstanceState) {
 4         super.onCreate(savedInstanceState);
 5         setContentView(R.layout.activity_radio_button);
 6         mrg1=findViewById(R.id.rg_1);
 7         mrg1.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
 8             @Override
 9             public void onCheckedChanged(RadioGroup radioGroup, int i) {
10                 RadioButton radioButton=radioGroup.findViewById(i);
11                 Toast.makeText(RadioButtonActivity.this, radioButton.getText(), Toast.LENGTH_SHORT).show();
12             }
13         });//弹出提示框
14 
15     }

 

标签:Toast,findViewById,onCreate,单选框,RadioGroup,Override,提示框,mrg1
来源: https://www.cnblogs.com/konglong-cm/p/15792064.html