private void initData() { try { JSONArray choiceArray = new JSONArray(choices); for (int i = 0; i < choiceArray.length(); i++) { RadioButton radioButton = (RadioButton) getLayoutInflater().inflate(R.layout.mq_item_form_radio_btn, null); radioButton.setText(choiceArray.getString(i)); radioButton.setTag(choiceArray.get(i)); radioButton.setId(View.NO_ID); radioButton.setOnCheckedChangeListener(this); MQUtils.tintCompoundButton(radioButton, R.drawable.mq_radio_btn_uncheck, R.drawable.mq_radio_btn_checked); radioGroup.addView(radioButton, LinearLayout.LayoutParams.MATCH_PARENT, MQUtils.dip2px(MQCollectInfoActivity.this, 48)); } } catch (JSONException e) { rootView.setVisibility(View.GONE); e.printStackTrace(); } }
inputRadioButton.setTag(pin); inputRadioButton.setChecked(pin.mode == PinData.kMode_Input || pin.mode == PinData.kMode_InputPullup); inputRadioButton.setVisibility(pin.isInput || pin.isInputPullup ? View.VISIBLE : View.GONE); outputRadioButton.setTag(pin); outputRadioButton.setChecked(pin.mode == PinData.kMode_Output); outputRadioButton.setVisibility(pin.isOutput ? View.VISIBLE : View.GONE); pwmRadioButton.setTag(pin); pwmRadioButton.setChecked(pin.mode == PinData.kMode_PWM); pwmRadioButton.setVisibility(pin.isPwm ? View.VISIBLE : View.GONE); analogRadioButton.setTag(pin); analogRadioButton.setChecked(pin.mode == PinData.kMode_Analog); analogRadioButton.setVisibility(pin.isAnalog ? View.VISIBLE : View.GONE); if (isInputModeVisible) { RadioButton floatingRadioButton = (RadioButton) convertView.findViewById(R.id.floatingRadioButton); floatingRadioButton.setTag(pin); floatingRadioButton.setChecked(pin.mode == PinData.kMode_Input); pullupRadioButton.setTag(pin); pullupRadioButton.setChecked(pin.mode == PinData.kMode_InputPullup); if (isStateVisible) { RadioButton lowRadioButton = (RadioButton) convertView.findViewById(R.id.lowRadioButton); lowRadioButton.setTag(pin); lowRadioButton.setChecked(pin.digitalValue == PinData.kDigitalValue_Low);
@Override public View getView(int i, View convertView, ViewGroup viewGroup) { ViewHolder holder; String color = getItem(i); if(convertView == null){ holder = new ViewHolder(); convertView = inflater.inflate(R.layout.item_shoppingcart_attribute,null); holder.rbAttribute = (RadioButton) convertView.findViewById(R.id.rb_attribute); convertView.setTag(holder); }else{ holder = (ViewHolder) convertView.getTag(); } holder.rbAttribute.setText(color); Log.d("hxl","color=="+color); holder.rbAttribute.setTag("rbAttribute"+i); holder.rbAttribute.setOnClickListener(new MyOnclickListerner(i)); return convertView; } class ViewHolder{
RadioButton radioButton = (RadioButton) inflater.inflate(R.layout.apptentive_survey_question_range_choice, radioGroup, false); radioButton.setText(defaultNumberFormat.format(i)); radioButton.setTag(i); radioButton.setOnCheckedChangeListener(this); radioGroup.addView(radioButton);
radio.setTag(map1); myRadioGroup.addView(radio);
rb.setTag(btnCodeArr[i]); rb.setText(btnNameArr[i]);
private void pairedBluetooth() { viewPairedDevices.removeAllViews(); Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); if (null != pairedDevices && pairedDevices.size() > 0) { StringBuilder msgBuilder = new StringBuilder(); int index = 0; for (BluetoothDevice device : pairedDevices) { RadioButton radioButton = new RadioButton(this); radioButton.setId(index++); radioButton.setText(String.format("%s\n%s", device.getName(), device.getAddress())); radioButton.setTag(device); viewPairedDevices.addView(radioButton); msgBuilder.append(String.format("%s %s\n", device.getName(), device.getAddress())); } tvContent.setText(msgBuilder.toString()); viewPairedDevices.setVisibility(View.VISIBLE); } else { viewPairedDevices.setVisibility(View.GONE); } }
/** * ピンを選択するためのRadioButtonを作成します. * @param inflater インフレータ * @param pin ピン * @return RadioButtonのインスタンス */ private RadioButton createRadioButton(final LayoutInflater inflater,final FaBoShield.Pin pin) { RadioButton radio = (RadioButton) inflater.inflate(R.layout.item_fabo_radio_button_pin, null, false); radio.setText(pin.getPinNames()[1]); radio.setTag(pin); radio.setEnabled(!usedPin(pin.getPinNumber())); radio.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(final CompoundButton compoundButton, final boolean b) { if (b) { mSelectedPin = pin; } } }); return radio; }
r.setTag(Integer.valueOf(i)); r.setEnabled(!prompt.isReadOnly()); r.setFocusable(!prompt.isReadOnly());
rbtn.setTag(group);
r.setText(prompt.getSelectChoiceText(mItems.get(i))); r.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); r.setTag(Integer.valueOf(i)); r.setId(QuestionWidget.newUniqueId()); r.setEnabled(!prompt.isReadOnly());
r.setText(prompt.getSelectChoiceText(mItems.get(i))); r.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mAnswerFontsize); r.setTag(Integer.valueOf(i)); r.setId(QuestionWidget.newUniqueId()); r.setEnabled(!prompt.isReadOnly());
mEntriesUpDownRadioPadding); newRadioButton.setCompoundDrawablePadding(0); newRadioButton.setTag(command); newRadioButton.setVisibility(View.VISIBLE); mRadioGroup.addView(newRadioButton, mLayoutParams);