private void addButton(SegmentedGroup group) { RadioButton radioButton = (RadioButton) getActivity().getLayoutInflater().inflate(R.layout.radio_button_item, null); radioButton.setText("Button " + (group.getChildCount() + 1)); group.addView(radioButton); group.updateBackground(); }
for (String string : getArguments().getStringArrayList(ARG_ARRAY)) { final RadioButton radioButton = new RadioButton(getActivity()); radioButton.setText(string); radioButton.setId(ViewUtils.generateViewId()); radioGroup.addView(radioButton);
for (AdapterChoiceItem item : choices) { final RadioButton radioButton = (RadioButton) inflater.inflate(R.layout.list_radio_icon_item, null); radioButton.setText(item.description); radioButton.setCompoundDrawablesWithIntrinsicBounds(item.icon, 0, 0, 0); radioButton.setChecked(false);
RadioButton rdbtn = new RadioButton(view.getContext()); rdbtn.setId(i); rdbtn.setText(address[i]); if (h.equals(address[i])) { rdbtn.setChecked(true);
button1.setText(name != null && name.length() == 0 ? getString(R.string.defaultProfile) : name); RadioButton rdbtn = new RadioButton(this); rdbtn.setId(counter++); rdbtn.setText(profile); profiles.addView(rdbtn); button2.setText(name != null && name.length() == 0 ? getString(R.string.profile1) : name); name = prefs.getString("profile2", getString(R.string.profile2)); button3.setText(name != null && name.length() == 0 ? getString(R.string.profile2) : name); name = prefs.getString("profile3", getString(R.string.profile3)); button4.setText(name != null && name.length() == 0 ? getString(R.string.profile3) : name); RadioButton rdbtn = new RadioButton(this); rdbtn.setId(id.intValue()); rdbtn.setText(profile); profiles.addView(rdbtn);
@Override public void setText(SpannableStringBuilder builder) { ((RadioButton) this).setText(builder); }
/** * 小时 选择器 改变 监听 * * @param timePicker * @param i * @param i1 */ @Override public void onTimeChanged(TimePicker timePicker, int i, int i1) { calendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH)); calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, i); calendar.set(Calendar.MINUTE, i1); timeButton.setText(simpleTimeFormat.format(calendar.getTime())); }
/** * Adjust the title based on the credit card's payment day. */ private void setLabels() { Calendar date = new GregorianCalendar(year, month, 1); SimpleDateFormat dateFormat = new SimpleDateFormat("MMMMM yyyy"); String pd = dateFormat.format(date.getTime()); TextView label = (TextView)findViewById(R.id.closing_day_reference_period); label.setText(getString(R.string.reference_period)+"\n" + pd); regularCD.setText(getString(R.string.regular_closing_day)+" ("+regularClosingDay+")"); }
/** * 日期 选择 器 改变 监听 * * @param datePicker * @param i * @param i1 * @param i2 */ @Override public void onDateChanged(DatePicker datePicker, int i, int i1, int i2) { calendar.set(Calendar.YEAR, datePicker.getYear()); calendar.set(Calendar.MONTH, datePicker.getMonth()); calendar.set(Calendar.DAY_OF_MONTH, datePicker.getDayOfMonth()); calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR)); calendar.set(Calendar.MINUTE, calendar.get(Calendar.MINUTE)); dateButton.setText(simpleDateFormat.format(calendar.getTime())); // Log.i("testss", simpleDateFormat.format(calendar.getTime())); }
@Override protected void onPostExecute(Void aVoid) { tv.setText(R.string.intro_discoveryFinished); pbar.setVisibility(View.GONE); RadioButton button = new RadioButton(getActivity()); button.setText(R.string.intro_urlNotFound); rg.addView(button); } }.execute((Void) null);
@Override public void onPageSelected(int position) { pos = position; position++; toolbar.setTitle(position + "/" + photos.size()); if (selectPhotos != null && selectPhotos.contains(photos.get(pos).getPath())) { checkbox.setChecked(true); if (pos == 1 && selectPhotos.contains(photos.get(pos - 1).getPath())) { checkbox.setChecked(true); } } else { checkbox.setChecked(false); } if (originalPicture) { radioButton.setText(getString(R.string.image_size, FileSizeUtil.formatFileSize(photos.get(pos).getSize()))); } }
public void onCreate(RadioButton[] rb) { for (int i = 0; i < rb.length; i++) { rb[i].setText(FileType.values()[i].getDescriptionId()); rb[i].setChecked(i == fileType.ordinal()); } }
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(); } }
protected final void setGuestEmailRequired(boolean required) { this.emailRequired = required; if (required) { optionAnonymous.setText(R.string.air_label_use_email); ((TextInputLayout) findViewById(R.id.air_inputEmailParent)).setHint(getString(R.string.air_label_email)); } else { optionAnonymous.setText(R.string.air_label_use_guest); ((TextInputLayout) findViewById(R.id.air_inputEmailParent)).setHint(getString(R.string.air_label_email_optional)); } }
private void initMenus(String[] menus){ RadioGroup.LayoutParams layoutParams = new RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(5, 10, 5, 10); rbList = new ArrayList<>(); for (String menu : menus){ RadioButton rbMenu = new RadioButton(getContext()); rbMenu.setText(menu); rbList.add(rbMenu); rgMain.addView(rbMenu, layoutParams); } } }
private RadioButton makeRadioButton(RadioGroup baks, final String bk, final boolean item) { RadioButton bkb = new RadioButton(this); bkb.setText(bk); bkb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (b) { selectedBackup = bk; selected = item; Log.d("backuppage", "selected = " + selectedBackup); backupSelected(selected); } } }); baks.addView(bkb); return bkb; }
private void AddButton(String text, int id) { RadioButton newRadioButton = new RadioButton(this); newRadioButton.setText(text); newRadioButton.setId(id); LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams( RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT); radioGroup.addView(newRadioButton); }
private void AddButton(String text, int id) { RadioButton newRadioButton = new RadioButton(this); newRadioButton.setText(text); newRadioButton.setId(id); LinearLayout.LayoutParams layoutParams = new RadioGroup.LayoutParams( RadioGroup.LayoutParams.WRAP_CONTENT, RadioGroup.LayoutParams.WRAP_CONTENT); radioGroup.addView(newRadioButton); }
public void onCreate(RadioButton[] rb) { for (int i = 0; i < rb.length; i++) { final String text = ctx.getString(R.string.dialog_function_selection) + " " + Integer.toString(i + 1) + ":"; rb[i].setText(text); final Paint p = functions.get(i).getLineParameters().getPaint(); final int textWidth = (int) rb[i].getPaint().measureText(text); rb[i].setCompoundDrawables(null, null, new LineDrawable(p, textWidth, (int) (p.getStrokeWidth() + 4)), null); rb[i].setCompoundDrawablePadding(ctx.getResources().getDimensionPixelSize( R.dimen.dialog_content_padding)); } }
@Override protected Void doInBackground(Void... voids) { mDiscovery.discover(serverUrl -> getActivity().runOnUiThread(() -> { RadioButton button = new RadioButton(getActivity()); button.setText(serverUrl); rg.addView(button); })); return null; }