radio-button

NullPointerException in RadioGroup.setOnCheckedChangeListener in APIS 15 & 16

徘徊边缘 提交于 2019-12-23 03:39:10
问题 Actually, I've to ask you a question about NPE in setOnCheckedChangeListener of RadioGroup. I've tested this code in APIs from 15 to 23, and only crashes is APIs 15 & 16. At first, i dont need to solve the NPE, i did it. I need to know why android assigns a negative value to radioButton ID, which causes NULL return in 'group.findViewById'. Here we've the code: private List<Question> listItems; private Question getItem(int position) { return listItems.get(position); } @Override public

android RadioButton image and text

拟墨画扇 提交于 2019-12-23 02:32:28
问题 Im using a radio button to create a custom tab host, is working fine, but now I need to show the icon on top and the text underneath the icon, this is what I have now: but this is what I need: This is my code: <RadioButton android:id="@+id/rad_home" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:background="@drawable/rad_background" android:button="@drawable/home_icon" android:gravity="center" android:text="Home" android:textColor="

How to uncheck or clear the radiobutton group?

元气小坏坏 提交于 2019-12-23 02:05:25
问题 I'm new to android.. Im facing a problem in uncheck the radio button in a group.... My problem is.... I am developing an quiz based app. there will be 1 quest and 4 opt(radio buttons) when user opens this app radio button will be unchecked but the prob comes when the user answers 1 quest and when he goes for next quest radio button will be checked.I want to uncheck/reset the radio buttons for every quest.How can i do it? Another problem which im facing is... If suppose the user selected first

jQuery not working on clicking radiobutton

六眼飞鱼酱① 提交于 2019-12-22 11:14:28
问题 my code: $(document).ready(function(){ alert("document ready"); $("input[type=radio]").click(function(event){ alert("clicked"); }); }); But no alert shows up... And, when typing in on the console: $(document).ready(function(){ alert("document ready");}) I get the alert! What is going on here? 回答1: try .change() instead of .click() $(document).ready(function(){ alert("document ready"); $("input[type=radio]").change(function(){ alert("clicked"); }); }); 回答2: I found the solution, it explains as

Android: custom layout for Radio Group

为君一笑 提交于 2019-12-22 10:52:57
问题 I'm trying to create a 2x2 array of radio buttons, but I don't know how to customize layout other than horizontal or vertical. Any ideas? I've only gotten A B C D and A B C D but I want to have A B C D EDIT: I resolved this issue. For anyone wondering, I set up two individual radio groups (i.e. one with AB and one with CD). I set onClickListener() for each RadioButton, and used clearCheck() on the second RadioGroup when a button in the first RadioGroup was clicked, and vice versa. 回答1: You

use an image for radio button label rails 4

我只是一个虾纸丫 提交于 2019-12-22 10:52:40
问题 I am trying to use the helper collection_radio_buttons to show an image as a label, and want to save the image_id to the model so that I can retrieve the url, so far i have come up with this which shows a radio button and the image_url as the label Something i have noticed already is that i can only click the radio button once and it then just stays in its on state <%= f.collection_radio_buttons(:default_image_id, DefaultImage.all, :id, :image) %> The html generated looks like so <input id=

How to set radio buttons in a nested group box as a same group with radio buttons outside of that group box [duplicate]

岁酱吖の 提交于 2019-12-22 09:18:41
问题 This question already has answers here : Grouping Windows Forms Radiobuttons with different parent controls in C# (4 answers) Closed last year . I have winform application (.NET 4.0) Is there any way to manually set a group of radio buttons? I have four radio buttons, two of them inside of a group box and the other two outside of that box. How can I set all of them to the same group? 回答1: This might have been answered in another post, it sounds the same: Grouping Windows Forms Radiobuttons

Only allowing selection of one radio button in a form with PHP

孤人 提交于 2019-12-22 08:52:42
问题 A very basic question... How can I only allow the selection of one option in a list of radio buttons? <form action="process_repair.php" method="POST"> <label for "repair_complete">Repair complete</label> <input type="radio" name="Yes" value="true"> <input type="radio" name="No" value="false"> </form> When this code runs, it's possible to select both radio buttons, but I'd like them to interact so you can only select one or the other. Any help much appreciated! :) 回答1: Give them the same name.

Keep radio button selected after a form submit

馋奶兔 提交于 2019-12-22 08:03:22
问题 I am using below code to keep the radio button selection after a form submission, but it keep resetting to the last button after form submission <input type="radio" name="button" value="Yes" <?php if(isset($_POST['button']) == 'Yes') echo ' checked="checked"';?> />Yes <input type="radio" name="button" value="No" <?php if(isset($_POST['button']) == 'No') echo ' checked="checked"';?> />No How can I keep the selection ? 回答1: isset() returns a boolean. As such, comparing directly to Yes / No is

android RadioButton option on the right side of the text

社会主义新天地 提交于 2019-12-22 06:48:39
问题 How can I create a RadioButton with the option on the right side of the text? 回答1: It's ok, I use CheckTextView instead 回答2: Like @Arutha mentioned in the above answer, you can use a CheckedTextView . This can be done by using a built-in Android layout (as I posted here) - android.R.layout.simple_list_item_single_choice : <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2008 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not