radio-group

RadioGroup with only one selected Item

半城伤御伤魂 提交于 2019-12-06 02:14:29
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" android:layout_weight="1" android:text="@string/radio1" /> <RadioButton android:id="@+id/radio2" android

RadioButton with Custom View Android

做~自己de王妃 提交于 2019-12-05 17:27:42
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 that or is there any other way to implement that. I also searched a lot. But I can't able to find anything

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

我的未来我决定 提交于 2019-12-04 14:10:53
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_contactno; private RadioGroup radioGroup_gender; private RadioButton radioButton_male; private RadioButton

How to dynamically add radiobuttons and not lose view contents

☆樱花仙子☆ 提交于 2019-12-04 12:59:13
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" android:orientation="vertical" android:id="@+id/SelectRestaurant"> </RadioGroup> <Button android

Only one radio button selected at a time

若如初见. 提交于 2019-12-04 08:59:32
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 method onRadioButtonClick in order to make sure that only one radio button had drawable:checkbox and the other has checkbox_v . How can I implemnt onRadioClick to do this? any idea? public void onRadioButtonClick(View v) { RadioButton button = (RadioButton) v; boolean checkBox1Selected; boolean checkBox2Selected = false; Toast.makeText(MainActivity.this, button.getId()+ " was chosen."+R.id

Radio Group in ExtJS Editor Grid/Grid

▼魔方 西西 提交于 2019-12-04 07:57:40
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) I created a radio group component: Ext.define('Ext.ux.grid.column.RadioGroupColumn', { extend: 'Ext.grid.column.Column', alias: 'widget.radiogroupcolumn', /* author: Alexander Berg, Hungary */ defaultRenderer: function(value, metadata

android onCheckedChanged for radiogroup

走远了吗. 提交于 2019-12-03 23:19:46
问题 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 that. The onCheckedChanged is running fine when clicked on. RadioGroup ItemtypeGroup = (RadioGroup) findViewById(R.id.rechargeItemtype); RadioButton providerRadio = (RadioButton) findViewById(R.id.a); providerRadio.performClick(); ItemtypeGroup.setOnCheckedChangeListener(new

RadioGroup extending RelativeLayout?

大城市里の小女人 提交于 2019-12-03 13:41:06
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 RadioButtons using RelativeLayout INSIDE the RadioGroup the RadioGroup doesn't see the Buttons inside the RelativeLayout . So in order to fix this I want to make a custom RadioGroup that extends RelativeLayout instead of LinearLayout. How do I do this? UPDATE: I did what you said but I have these errors I don't know how to fix in the class file: Description Resource Path Location Type RadioGroup

android add padding between radiogroup buttons programmatically

僤鯓⒐⒋嵵緔 提交于 2019-12-03 11:08:19
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, null); params. ... ?????? currentButton.setLayoutParams(params); Padding Normal LayoutParams don't have

how can i send radio button value and switch case option to server using json android?

你离开我真会死。 提交于 2019-12-02 12:58:23
I'm trying to make a registration form where all values are saving on the server, but i dont know how to send the radio buttons' value and switch option buttons' value to server. I tried implementing this for the Radio buttons, but when this activity opens, it only shows radio button value that too only once. Kindly tell me the correct way of doing this for both radio button and switch? Registration Activity package com.example.zeba.broccoli; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle;