radio-group

Multiple radio button groups in one form

我的梦境 提交于 2019-11-26 07:25:50
问题 Is it possible to have multiple radio button groups in a single form? Usually selecting one button deselects the previous, I just need to have one of a group deselected. <form> <fieldset id=\"group1\"> <input type=\"radio\" value=\"\"> <input type=\"radio\" value=\"\"> </fieldset> <fieldset id=\"group2\"> <input type=\"radio\" value=\"\"> <input type=\"radio\" value=\"\"> <input type=\"radio\" value=\"\"> </fieldset> </form> 回答1: Set equal name attributes to create a group; <form> <fieldset

How to group RadioButton from different LinearLayouts?

本小妞迷上赌 提交于 2019-11-26 06:05:56
问题 I was wondering if is possible to group each single RadioButton in a unique RadioGroup maintaining the same structure. My structure look like this: LinearLayout_main LinearLayout_1 RadioButton1 LinearLayout_2 RadioButton2 LinearLayout_3 RadioButton3 As you can see, now each RadioButton is a child of different LinearLayout . I tried using the structure below, but it doesn\'t work: Radiogroup LinearLayout_main LinearLayout_1 RadioButton1 LinearLayout_2 RadioButton2 LinearLayout_3 RadioButton3

How to set OnClickListener on a RadioButton in Android?

笑着哭i 提交于 2019-11-26 04:21:20
I have two RadioButton s inside a RadioGroup . I want to set OnClickListener on those RadioButton s. Depending on which RadioButton is clicked, I want to change the text of an EditText . How can I achieve this? Ricky I'd think a better way is to use RadioGroup and set the listener on this to change and update the View accordingly (saves you having 2 or 3 or 4 etc listeners). RadioGroup radioGroup = (RadioGroup) findViewById(R.id.yourRadioGroup); radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { //

How to get the selected index of a RadioGroup in Android

▼魔方 西西 提交于 2019-11-26 04:05:51
问题 Is there an easy way to get the selected index of a RadioGroup in Android or do I have to use OnCheckedChangeListener to listen for changes and have something that holds the last index selected? example xml: <RadioGroup android:id=\"@+id/group1\" android:layout_width=\"fill_parent\" android:layout_height=\"wrap_content\" android:orientation=\"vertical\"> <RadioButton android:id=\"@+id/radio1\" android:text=\"option 1\" android:layout_width=\"wrap_content\" android:layout_height=\"wrap_content

How to set OnClickListener on a RadioButton in Android?

不问归期 提交于 2019-11-26 01:47:17
问题 I have two RadioButton s inside a RadioGroup . I want to set OnClickListener on those RadioButton s. Depending on which RadioButton is clicked, I want to change the text of an EditText . How can I achieve this? 回答1: I'd think a better way is to use RadioGroup and set the listener on this to change and update the View accordingly (saves you having 2 or 3 or 4 etc listeners). RadioGroup radioGroup = (RadioGroup) findViewById(R.id.yourRadioGroup); radioGroup.setOnCheckedChangeListener(new