Questions tagged [radio-group]

radio-group is used to create a multiple-exclusion scope for a set of radio buttons. Checking one radio button that belongs to a radio group unchecks any previously checked radio button within the same group.

radio-group
Filter by
Sorted by
Tagged with
236 votes
19 answers
247k views

How to get the selected index of a RadioGroup in Android

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? ...
John Boker's user avatar
  • 83.2k
179 votes
6 answers
473k views

Multiple radio button groups in one form

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 ...
AlexG's user avatar
  • 5,809
151 votes
8 answers
197k views

How to set radio button checked as default in radiogroup?

I have created RadioGroup and RadioButton dynamically as following: RadioGroup radioGroup = new RadioGroup(context); RadioButton radioBtn1 = new RadioButton(context); ...
Sandeep Kumar P K's user avatar
131 votes
9 answers
238k views

How to set OnClickListener on a RadioButton in Android?

I have two RadioButtons inside a RadioGroup. I want to set OnClickListener on those RadioButtons. Depending on which RadioButton is clicked, I want to change the text of an EditText. How can I achieve ...
mayur rahatekar's user avatar
103 votes
21 answers
52k views

How to group RadioButton from different LinearLayouts?

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 ...
marcoqf73's user avatar
  • 1,324
86 votes
11 answers
247k views

How to check if a radiobutton is checked in a radiogroup in Android?

I need to set validation that user must fill / select all details in a page. If any fields are empty wanna show Toast message to fill. Now I need set validation for RadioButton in the RadioGroup. I ...
Srihari's user avatar
  • 2,419
72 votes
12 answers
128k views

RadioGroup: How to check programmatically

I create a RadioGroup from XML <RadioGroup android:id="@+id/option" android:layout_width="match_parent" android:orientation="horizontal" android:checkedButton="@+id/...
Bao Le's user avatar
  • 17.1k
67 votes
6 answers
223k views

AngularJs: How to set radio button checked based on model

I have a model returning in the storeLocations object with a isDefault value. if isDefault returns true, I wan't to set that radio button in the group as checked. Not sure if I need to do a $each(...
Christopher Marshall's user avatar
64 votes
6 answers
121k views

Android: RadioGroup - How to configure the event listener

From my understanding, to determine if a checkbox is "clicked" and find if it's checked or not, code such as the following can be used: cb=(CheckBox)findViewById(R.id.chkBox1); cb....
Ryan's user avatar
  • 9,919
41 votes
8 answers
50k views

How to disable a RadioGroup until checkbox is checked

I have a radio group which I do not want to user to be able to select any of the buttons until a particular checkbox is selected within my app. If the checkbox is unticked then this disables the radio-...
W0lf7's user avatar
  • 729
38 votes
8 answers
176k views

Set mat-radio-button default selected in a mat-radio-group with angular2

I got this problem in my angular app. I have many options in a mat-radio-group but these are dynamically placed according to a json object. Something like this: This is the json object { "list": [ ...
Sergio Mendez's user avatar
37 votes
5 answers
150k views

Multiple radio button groups in MVC 4 Razor

I need to have multiple radio button groups in my form like this: I know it's simply done by specifying the same "name" html attribute for each group. HOWEVER MVC doesn't let you specify your own ...
Ali's user avatar
  • 1,152
35 votes
4 answers
65k views

binding radiobuttons group to a property in WPF

Let's imagine that I have: <RadioButton GroupName="Group1" IsChecked="{Binding Path=RadioButton1IsChecked}" /> <RadioButton GroupName="Group1" IsChecked="{Binding Path=RadioButton2IsChecked}"...
Bogdan Verbenets's user avatar
33 votes
3 answers
26k views

Get the array of RadioButtons in a RadioGroup in Android

Is there any way of getting an array (or a collection) of the RadioButtons in an Android RadioGroup? I would like to add individual listeners to radio buttons but I don't see any obvious way of ...
Tim's user avatar
  • 5,767
33 votes
3 answers
25k views

How to evenly space out radiobuttons in Android?

I have three radiobuttons and I want to evenly space them across the screen. When I use android:layout_weight="1", the buttons are stretched out across the screen. So how would I have the same amount ...
rasen58's user avatar
  • 4,931
32 votes
6 answers
81k views

android onCheckedChanged for radiogroup

I'm writing an Activity in android where I have two radio buttons under a RadioGroup. One of them is checked by default. But I can't trigger the event in onCreate method so that I can do something in ...
user2534310's user avatar
31 votes
4 answers
66k views

With Bootstrap, how do I show radio inputs as buttons?

My form currently contains this code: <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/> <label for="opt-0"><input type="radio" ...
Likk's user avatar
  • 747
30 votes
13 answers
41k views

RadioGroup with two columns which have ten RadioButtons

I have a RadioGroup and I want to align buttons next to each other in two columns and five rows and I am unable to achieve it. Things I have tried: RelativeLayout -> Outside RadioGroup -> Inside ...
Jason Wood's user avatar
27 votes
4 answers
24k views

Android radiogroup, divider between radiobuttons

Is there a simple way to add a divider between RadioButtons inside a RadioGroup? I've tried using the divider xml attribute and it doesn't seem to be working. In case it's relevant, the RadioGroup in ...
Karakuri's user avatar
  • 38.4k
26 votes
5 answers
9k views

RadioGroup calls onCheckChanged() three times

I've been struggling with an issue of programmatic checking of a RadioButton, which is situated in a RadioGroup. It seems that a single check() call raises three events - once for the first ...
user avatar
21 votes
2 answers
30k views

How do I listen for changes to a RadioGroup's selected value using JQuery?

I need to register a handler for a group of radio buttons. I'm using JQuery and hoped that its .change method would accomplish this. However I have not experienced the desired behavoir. Here is a ...
Justin's user avatar
  • 10.8k
21 votes
1 answer
23k views

Making RadioGroup radio buttons with images in Android... How?

Is it possible to make Radio Buttons in Android, where there are image representation to a button instead of a regular buttons? I want it to look something like that: The cyan in the middle ...
Igal's user avatar
  • 5,933
18 votes
4 answers
34k views

Manage Layout Inside a Horizontal Oriented Radiogroup

I am using a TableLayout with TableRows as my main activity. Inside the TableLayout is a Radio Group containing 2 Radio Buttons inside the activity (the Radio Group being inside a table row). I want ...
deteego's user avatar
  • 181
17 votes
7 answers
13k views

Preparing customized radio group type of layout

I am trying to prepare custom radiogroup like layout in the below image. I have nearly 8-10 rows to do that. So, I prepared one linear layout which has horizontal orientation and added the imageview, ...
Apparatus's user avatar
  • 411
17 votes
3 answers
21k views

Custom layout for RadioButton

Is there any way I can change the layout for a RadioButton and still have the RadioGroup recognise it? what I need is that the layout will include a couple of EditText fields so that when the user ...
theblitz's user avatar
  • 6,813
16 votes
9 answers
30k views

How to check which radio button of a radio group is selected? [ANDROID]

I am using two radio groups with multiple radio buttons, I want to check which radio button is selected so that I can call specific functions accordingly. I am using getCheckedRadioButtonId method to ...
User's user avatar
  • 722
14 votes
6 answers
41k views

radio group setOnCheckedChangeListener

I have some problem with radio group, I am new to Android development so I don't have much idea to how can handle it.This is form which has some input filed and radio group for choosing gender and ...
mkafiyan's user avatar
  • 944
14 votes
3 answers
18k views

RadioGroup empty field check using setError in Android

I was wondering how to setError for a RadioGroup[gender] with RadioButton's [gender_b,gender_c] if it is null. This is how i'm getting the RadioButton values though: private boolean genradiocheck() {...
MetaldroiD's user avatar
14 votes
1 answer
14k views

android add padding between radiogroup buttons programmatically

I have a radiogroup in xml, and the buttons are generated programmatically. How do I add spacing between the buttons programmatically. I thought it was something like LayoutParams but my object doesn'...
CQM's user avatar
  • 43.5k
13 votes
1 answer
28k views

Make mat-radio-button a required field in a form

I am using a form in Angular 6, and I am disabling the submit button on this condition: <button tabindex="-1" mat-raised-button class="submit-btn" color="primary" type="submit" [disabled]="!...
Michael's user avatar
  • 3,163
9 votes
3 answers
10k views

RadioButtons with TextView in RadioGroup

Is it possible to add TextView below RadioButton in RadioGroup in any other way than extending and creating my custom RadioButton?
Michal's user avatar
  • 15.6k
9 votes
3 answers
17k views

AngularJS: Binding boolean value to radio button such that it updates model to false on uncheck event

In my AngularJS application, I am displaying contacts data in a grid. My typical contacts JSON looks like as below ... [ { type: "IM", value: "mavaze123", default: true }, { type: "IM", value:...
mavaze's user avatar
  • 1,187
8 votes
6 answers
42k views

extJS RadioGroup setValue() function

I have created RadioGroup using the code var radios = new Ext.form.RadioGroup({ columns : 2, items: [ {boxLabel: 'E-Mail', name: 'communication', inputValue: 1}, ...
Sapan's user avatar
  • 83
8 votes
2 answers
3k views

How can I change a label text without interfering with an input radio inside the label?

In my html template I've got a label with an input radio inside: <label id="myid" class="inline"> <input type="radio" value ="11"> my text </label> I need to change the ...
kiks73's user avatar
  • 3,728
8 votes
1 answer
7k views

How can I create multiple radio button groups on a single form?

With VCL, we had a TRadioGroup class with an Items property you could modify at design time. With Firemonkey, we only have the TRadioButton class. From what I understand, if you add objects of type ...
ardnew's user avatar
  • 2,068
8 votes
2 answers
42k views

Which radio button is selected in a TRadioGroup?

As you can see in my question history, I'm developing a eBook manager, that will be open-source and I will release it in about 10 days, but I have a TRadioGroup, as you can see: TRadioGroup Used On My ...
Nathan Campos's user avatar
8 votes
1 answer
6k views

How to get value from Radio group in Jetpack Compose

I'm beginner in Jetpack Compose, so I don't know how can I get value from Radio group that I created. This is my Radio group composable function: @Composable fun KindRadioGroup( mItems: List<...
Hooman Hooshyar's user avatar
8 votes
1 answer
3k views

Grails RadioGroup, how to bind labels to radio name

I'm struggling arround with the g:radioGroup tag -- I want to create some radios and some labels correspondig to the radios: <g:radioGroup name="stateOfHealth" value="${review.stateOfHealth}" id="...
john Smith's user avatar
  • 17.7k
7 votes
2 answers
14k views

reset my checked radiogroup when the radiogroup is used again in the same activity

I am making a quiz application...I am accessing the questions through "id"...every time a question is answered(any radio button is checked),the id is incremented and doInBackground() function is ...
sagar's user avatar
  • 161
7 votes
3 answers
3k views

RadioGroup extending RelativeLayout?

I'm trying to make a grid of radio buttons for my app, what I have learned is that this isn't possible using regular RadioGroup because it extends LinearLayout and if you try to arrange the ...
Kyle V.'s user avatar
  • 4,772
7 votes
3 answers
9k views

SWT: set radio buttons programmatically

When I create a couple of radio buttons (new Button(parent, SWT.RADIO)) and set the selection programmatically using radioButton5.setSelection(true) the previously selected radio button also remains ...
Mot's user avatar
  • 29k
7 votes
1 answer
6k views

Android dynamic RadioGroup/RadioButtons as flat buttons

this is a similar issue to what is mentioned in a related post but I thought it was different enough to get its own question. Here it goes: I have been able to get the "radio circle" to disappear no ...
aveyD's user avatar
  • 525
7 votes
0 answers
835 views

Radio Group not getting Focus in Android

So I have a form that contains two EditText components and a RadioGroup. When I click on one of the EditText fields the keyboard pops-out and I can right and everything is great. UNTIL I click on one ...
Mohamed Sobhy's user avatar
6 votes
3 answers
10k views

how can i set RadioGroup unchecked by default in android?

I am doing an app to conduct simple quiz.I have given the answers are multiple choice using RadioGroup. So on loading each question how can I set RadioGroup unchecked by default ?
Mohammed mansoor's user avatar
6 votes
3 answers
4k views

remove dynamicallly created radiobuttons from a radiogroup in Android

:) My RadioGroup's RadioButtons get dynamically created from an ArrayList (which resides in my main activity) full of links like so: ArrayList = { "hxxp://helloworld.com", "hxxp://helloworld2.net", .....
jeremy's user avatar
  • 145
6 votes
1 answer
8k views

RadioButton with Custom View Android

I'm trying to implement a radiobuttons with custom views like the below screenshot. The count of the radio button will be dynamic. I tried to create a Radiogroup and added the RadioButton to the ...
Mahendran Sakkarai's user avatar
6 votes
3 answers
8k views

Radio Button in one radio group in 2 horizontal line

i try to set 4 radio button in one Radio group in 2 lines, but problem is that when i take linear layout with horizontal orientation then radio group functionality not work . All Radio buttons select ....
Shivang Trivedi's user avatar
5 votes
5 answers
42k views

Only one radio button selected at a time

I have two radio button in a radio group. I also have 2 androd:button checkbox- for when the radio button is deselected and checkbox_v for when he user selects the checkbox. I also implemnted that a ...
user182192's user avatar
5 votes
2 answers
8k views

Possible to allow all radio buttons to be unchecked in an Android app?

Just wanted to see if anyone knows if there's a radiogroup or radiobutton attribute or something else quick that will allow radio buttons to be unchecked when they're in checked mode. I'm looking to ...
wajiw's user avatar
  • 12.3k
5 votes
3 answers
13k views

Radio Button findViewById within a Fragment

I have looked around and implemented some of the things that I have found in order to get the findViewById to work inside my Fragment. However, I get either the cannot resolve method findViewById or I ...
James Robert Singleton's user avatar

1
2 3 4 5
22