radio-group

android add padding between radiogroup buttons programmatically

给你一囗甜甜゛ 提交于 2019-12-09 09:27:30
问题 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't come with an obvious setPadding or setMargins method. This is what I was trying RadioButton currentButton = new RadioButton(context); currentButton.setText(item.getLabel()); currentButton.setTextColor(Color.BLACK); //add padding between buttons LayoutParams params = new LayoutParams(context,

How can I add radio buttons to a radio group I've made programmatically?

佐手、 提交于 2019-12-08 15:04:28
问题 I am completely new to Android i tried whatever I thought may work but everytime I get error. What's wrong here? main_activity.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp" tools:context=".Main" android:orientation="vertical" android:id="@+id/mainLayout"> <LinearLayout android:layout_width="fill_parent" android:layout

Android : Radio Buttons keep changing their state when List View Scrolled

送分小仙女□ 提交于 2019-12-08 12:05:05
问题 I have a listview with three Radio Buttons in a list item, Issue is that when I scroll list view, the radio buttons selected position gets changed. So please let me know how to keep radio button's selection intact even if I scroll list view. My code is, RadioGroupAdapter.java public RadioGroupAdapter(Context context, int layoutResourceId, Option[] data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; } @Override

How to work with RadioGroup in RibbonControl in WInforms Devexpress?

老子叫甜甜 提交于 2019-12-08 11:31:38
问题 Hi, I need RadioButton on Ribbon Control so I used RadioGroup and created event selectedIndexChanged , In which I performed some tasks private void repositoryItemRadioGroup1_SelectedIndexChanged(object sender, EventArgs e) { RadioGroup rg = (RadioGroup)sender; int index = rg.SelectedIndex; if (index == 0) { // code } if (index == 1) { // code } if (index == 2) { // code } else if (!(index == 2) || !(index == 1)) { // code } } Till now the code work fine.in beforeLeaveRow event I am performing

How to get values from dynamic radiogroup android?

天涯浪子 提交于 2019-12-08 10:54:08
问题 Hi i created dynamic radiogroup with radiobutton.Now i want to get values from dynamic radiogroup. Below is my code final RadioGroup rg = new RadioGroup(this); rg.setId(questionNo); RadioButton[] rb = new RadioButton[answers.length()]; for (int i = 0; i < answers.length(); i++) { JSONObject answerObject = answers.getJSONObject(i); rb[i] = new RadioButton(this); rb[i].setText(answerObject.getString("AnswerValue")); rb[i].setId(answerObject.getInt("AnswerId")); rg.addView(rb[i]); } rg

RadioGroup with only one selected Item

…衆ロ難τιáo~ 提交于 2019-12-07 15:44:51
问题 I am trying to make a RadioGroup as in the image. I want that only one RadioButton should be checked at a time. This is what I did to achive this. <RadioGroup android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > <RadioGroup android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content"

RadioButton with Custom View Android

好久不见. 提交于 2019-12-07 10:29:12
问题 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 RadioGroup using addView programatically. But it is not possible to setText as like in the attached screenshot. So I plan to add a LinearLayout and when OnClick the LinearLayout I will enable the RadioButton attached to the LinearLayout and disable rest of them. Whether it is the correct way to do

How to dynamically add radiobuttons and not lose view contents

浪子不回头ぞ 提交于 2019-12-06 08:44:55
问题 My layout looks like this <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textStyle="bold" android:text="Please select the restaurant you want to rate: " /> <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content

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

拜拜、爱过 提交于 2019-12-06 06:50:05
问题 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 do this, but it's throwing null pointer exception. How this can be done in a correct way? I have tried other methods too. Any help will be appreciated. Here is my code public class MainActivity extends AppCompatActivity { private EditText et_name; private EditText et_age; private EditText et

Radio Group in ExtJS Editor Grid/Grid

不问归期 提交于 2019-12-06 03:31:09
问题 I need radio group in extjs grid. I can have the radiogroup as editor but users wants to directly select the option from radio. e.g. O yes O no O maybe instead of having yes as by default and once they select the cell, it gets converted to radio group (like how the editor grid works), they wants the default behavior as this options. (They dont want the drop down) 回答1: I created a radio group component: Ext.define('Ext.ux.grid.column.RadioGroupColumn', { extend: 'Ext.grid.column.Column', alias