private void setUserProperty() { this.picker_layout = (LinearLayout) findViewById(R.id.picker_layout); TextView text = (TextView) findViewById(R.id.user_property_text); this.hint = (TextView) findViewById(R.id.hint); text.setText(R.string.ov); ((RadioGroup) findViewById(R.id.switch_bottom)).setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.yes: UserMcGoView.this.setBottomVisible(Boolean.valueOf(false)); return; case R.id.no: UserMcGoView.this.setBottomVisible(Boolean.valueOf(true)); return; default: return; } } }); }
private void initIpView() { this.cbIPConnect.setChecked(BlackTech.isIPConnectOpen()); this.cbIPConnect.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { BlackTech.setIPConnectOpen(isChecked); String str = "IP直连已:%s"; Object[] objArr = new Object[1]; objArr[0] = BlackTech.isIPConnectOpen() ? "开启" : "关闭"; ChangeEnvironmentActivity.this.showMessage(ChangeEnvironmentActivity.this .cbIPConnect, String.format(str, objArr)); ChangeEnvironmentActivity.this.showIPs(); } }); String env = BlackTech.getApiEnvironment(); if (BlackTech.API_ENV_QA.equals(env)) { this.rbQA.setChecked(true); } else if (BlackTech.API_ENV_RC.equals(env)) { this.rbRC.setChecked(true); } else { this.rbPRO.setChecked(true); } this.rgEnvironment.setOnCheckedChangeListener(this); }
/** * 初始化Layout。 */ private void initLayout() { findViewById(R.id.tts_play).setOnClickListener(TtsDemo.this); findViewById(R.id.tts_cancel).setOnClickListener(TtsDemo.this); findViewById(R.id.tts_pause).setOnClickListener(TtsDemo.this); findViewById(R.id.tts_resume).setOnClickListener(TtsDemo.this); findViewById(R.id.image_tts_set).setOnClickListener(TtsDemo.this); findViewById(R.id.tts_btn_person_select).setOnClickListener(TtsDemo.this); mRadioGroup=((RadioGroup) findViewById(R.id.tts_rediogroup)); mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.tts_radioCloud: mEngineType = SpeechConstant.TYPE_CLOUD; break; default: break; } } } ); }
public static AlertDialog createTheDialog(Context context,int titleId,OnCancelListener listener, OnCheckedChangeListener checkedChangeListener, android.widget.CompoundButton.OnCheckedChangeListener checkBoxChangeListener){ LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.has_same_file_check, null); AlertDialog dialog = new AlertDialog.Builder(context) .setView(view) .setTitle(titleId) .setOnCancelListener(listener) .create(); RadioGroup rg = (RadioGroup)view.findViewById(R.id.whichOperation); rg.setOnCheckedChangeListener(checkedChangeListener); CheckBox cb = (CheckBox)view.findViewById(R.id.doitasSame); cb.setOnCheckedChangeListener(checkBoxChangeListener); return dialog; }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.history); ButterKnife.inject(this); ((RadioGroup)findViewById(R.id.radioGroup)).setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch(checkedId) { case R.id.radio09: ((ImageView)findViewById(R.id.image)).setImageDrawable(getResources().getDrawable(R.drawable.graph1)); break; case R.id.radio10: ((ImageView)findViewById(R.id.image)).setImageDrawable(getResources().getDrawable(R.drawable.graph2)); break; case R.id.radio11: ((ImageView)findViewById(R.id.image)).setImageDrawable(getResources().getDrawable(R.drawable.graph3)); break; } } }); }
private void initSortByClick() { RadioGroup rgSortBy = (RadioGroup) findViewById(R.id. radioGroup1 ); rgSortBy.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { RadioButton rbName = (RadioButton) findViewById(R.id. radioName ); RadioButton rbCity = (RadioButton) findViewById(R.id. radioCity ); if (rbName.isChecked()) { getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "contactname" ).commit(); } else if (rbCity.isChecked()) { getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "city" ).commit(); } else { getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "birthday" ).commit(); } } }); }
@Override protected void createQuestionComponent(ViewGroup questionComponent) { mRadioGroup = new RadioGroup(getActivity()); for (Option option : getOptions()) { int optionId = getOptions().indexOf(option); RadioButton radioButton = new RadioButton(getActivity()); radioButton.setText(option.getText()); radioButton.setId(optionId); radioButton.setTypeface(getInstrument().getTypeFace(getActivity().getApplicationContext())); radioButton.setLayoutParams(new RadioGroup.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); mRadioGroup.addView(radioButton, optionId); } getRadioGroup().setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { setResponseIndex(checkedId); } }); questionComponent.addView(mRadioGroup); beforeAddViewHook(questionComponent); }
public void onGameInit() { wordToEvaluateText = (TextView) findViewById(R.id.wordToEvaluate); wordDifficultyRating = (RatingBar) findViewById(R.id.wordDifficultyRating); continueButton = (Button) findViewById(R.id.continueButton); submitEvaluation = (Button) findViewById(R.id.submitTranslation); qualityGroup = (RadioGroup) findViewById(R.id.qualityGroup); wordToEvaluateText.setText(word.getWord()); submitEvaluation.setVisibility(View.VISIBLE); continueButton.setVisibility(View.INVISIBLE); wordDifficultyRating.setEnabled(false); qualityGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == R.id.is_a_word) onYesSelected(); else if (checkedId == R.id.is_not_word) onNoSelected(); else if (checkedId == R.id.i_dont_know) onDontKnowSelected(); } }); }
public void showEditDialog() { if ( editDialog == null ) { editDialogView = LayoutInflater.from(this).inflate(R.layout.publish_edit_dialog_view, null); editDialogEditText = (EditText)editDialogView.findViewById(R.id.publish_edit_dialog_text); radioGroup = (RadioGroup)editDialogView.findViewById(R.id.publish_edit_dialog_select); radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub editDialogEditText.setText( ( ( RadioButton) group.findViewById(checkedId) ).getText().toString()); } }); editDialog = new AlertDialog.Builder(this).setView(editDialogView). setPositiveButton(R.string.dialog_button_sure, dialogClickListener). setNegativeButton(R.string.dialog_button_cancel, null).setTitle(R.string.reblog).create(); } editDialog.show(); }
@Override protected void onCreate(Bundle savedInstanceState) { setTheme(SampleList.THEME); //Used for theme switching in samples super.onCreate(savedInstanceState); setContentView(R.layout.text); ((TextView)findViewById(R.id.text)).setText(R.string.custom_navigation_content); //Inflate the custom view View customNav = LayoutInflater.from(this).inflate(R.layout.custom_view, null); //Bind to its state change ((RadioGroup)customNav.findViewById(R.id.radio_nav)).setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { Toast.makeText(CustomNavigation.this, "Navigation selection changed.", Toast.LENGTH_SHORT).show(); } }); //Attach to the action bar getSupportActionBar().setCustomView(customNav); getSupportActionBar().setDisplayShowCustomEnabled(true); }
@Override protected void installListeners() { // TODO Auto-generated method stub mSexRadioGroup .setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub if (checkedId == R.id.register_sex_female) { mSex = Const.FEMALE; } else { mSex = Const.MALE; } } }); }
/** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { Log.e(Constants.LOG, "onCreate called"); } super.onCreate(savedInstanceState); setContentView(R.layout.main); RadioGroup group1 = (RadioGroup) findViewById(R.id.orientation); group1.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.horizontal: group.setOrientation(LinearLayout.HORIZONTAL); break; case R.id.vertical: group.setOrientation(LinearLayout.VERTICAL); break; } } }); }
private void initView() { float calWeightWithBmiAndHeigt; if (this.user.begin_weight == 0.0f) { calWeightWithBmiAndHeigt = Utils.calWeightWithBmiAndHeigt(22.0f, this.user.height); } else { calWeightWithBmiAndHeigt = this.user.begin_weight; } this.defaultWeight = calWeightWithBmiAndHeigt; updateTargetView(this.user.targetWeight()); this.rvWeight.init(Utils.calWeightWithBmiAndHeigt(15.5f, this.user.height()), 200.0f, this.defaultWeight, 1.0f, 10, new OnValueChangeListener() { public void onValueChange(float value) { if (!ProfileInitThreeFragment.this.isRemoved()) { ProfileInitThreeFragment.this.updateWeightView(value); } } }); this.rgTarget.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { ProfileInitThreeFragment.this.target = Float.valueOf(String.valueOf(group .findViewById(checkedId).getTag())).floatValue(); ProfileInitThreeFragment.this.updateTargetView(ProfileInitThreeFragment.this .target); } }); if (this.user.target_weight > 0.0f) { this.rgTarget.check(R.id.rb_target_lose_weight); } else { this.rgTarget.check(R.id.rb_target_keep); } updateDateView(this.user.beginDate()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_register); DeviceUuidFactory uuid = new DeviceUuidFactory(this); uid = uuid.getDeviceUuid().toString(); emailEditText = (EditText)findViewById(R.id.email); emailEditText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);//设置限制邮箱格式 userNameEditText = (EditText) findViewById(R.id.username); passwordEditText = (EditText) findViewById(R.id.password); confirmPwdEditText = (EditText) findViewById(R.id.confirm_password); rg=(RadioGroup)findViewById(R.id.sex); b1=(RadioButton)findViewById(R.id.male); b2=(RadioButton)findViewById(R.id.female); rg.setOnCheckedChangeListener(new OnCheckedChangeListener(){ @Override public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub if(checkedId==b1.getId()){ sex = "1"; Toast.makeText(RegisterActivity.this,"男", Toast.LENGTH_LONG).show(); } if(checkedId==b2.getId()){ sex = "2"; Toast.makeText(RegisterActivity.this,"女", Toast.LENGTH_LONG).show(); } } }); }
private void initEvent() { seekbar_brightness.setOnSeekBarChangeListener(this); seekbar_contrast.setOnSeekBarChangeListener(this); seekbar_saturation.setOnSeekBarChangeListener(this); mPhotoEnhance=new PhotoEnhance(sourceMap); layout_tab.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { if(arg1==button_brightnessId){ seekbar_brightness.setVisibility(View.VISIBLE); seekbar_contrast.setVisibility(View.GONE); seekbar_saturation.setVisibility(View.GONE); } else if(arg1==button_contrastId){ seekbar_brightness.setVisibility(View.GONE); seekbar_contrast.setVisibility(View.VISIBLE); seekbar_saturation.setVisibility(View.GONE); } else if(arg1==button_saturationId){ seekbar_brightness.setVisibility(View.GONE); seekbar_contrast.setVisibility(View.GONE); seekbar_saturation.setVisibility(View.VISIBLE); } } }); btn_done.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { done(); } }); }
private void initRadioGroup() { rgLanuage = (RadioGroup) findViewById(R.id.rg_lanuage); rgLanuage.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { Log.i("GroupTest", "onCheckedChanged() group = " + group.getId() + " checkedId = " + (checkedId == R.id.rb_chinese ? "chinese" : "english")); } }); }
@Override public void setClickCallback(String code) { if (code == null) return; clickCallback = code; setOnCheckChangedListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { linker.execute(clickCallback); } }); }
@Override public void setSelectCallback(String code) { selectCallback = code; setOnCheckChangedListener(new RadioGroup.OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { linker.execute(selectCallback); } }); }
private void initSortOrderClick() { RadioGroup rgSortOrder = (RadioGroup) findViewById(R.id.radioGroup2 ); rgSortOrder.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { RadioButton rbAscending = (RadioButton)findViewById(R.id. radioAscending ); if (rbAscending.isChecked()) { getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortorder" , "ASC" ).commit(); } else { getSharedPreferences("MyContactListPreferences", MODE_PRIVATE ).edit().putString( "sortorder" , "DESC" ).commit(); } } }); }
private void initSortByClick() { RadioGroup rgSortBy = (RadioGroup) findViewById(R.id. radioGroup1 ); rgSortBy.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { RadioButton rbName = (RadioButton) findViewById(R.id. radioName ); RadioButton rbCity = (RadioButton) findViewById(R.id. radioCity ); if (rbName.isChecked()) { getSharedPreferences("MyNoteListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "subject" ).commit(); } else { getSharedPreferences("MyNoteListPreferences", MODE_PRIVATE ).edit().putString( "sortfield" , "created" ).commit(); } } }); }
private void initSortOrderClick() { RadioGroup rgSortOrder = (RadioGroup) findViewById(R.id.radioGroup2 ); rgSortOrder.setOnCheckedChangeListener( new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup arg0, int arg1) { RadioButton rbAscending = (RadioButton)findViewById(R.id. radioAscending ); if (rbAscending.isChecked()) { getSharedPreferences("MyNoteListPreferences", MODE_PRIVATE ).edit().putString( "sortorder" , "ASC" ).commit(); } else { getSharedPreferences("MyNoteListPreferences", MODE_PRIVATE ).edit().putString( "sortorder" , "DESC" ).commit(); } } }); }
@Override protected void createResponseComponent(ViewGroup responseComponent) { RadioGroup mRadioGroup = new RadioGroup(getActivity()); for (int i = 0; i < getQuestion().defaultOptions().size(); i++) { String option = getQuestion().defaultOptions().get(i).getText(); RadioButton radioButton = new RadioButton(getActivity()); radioButton.setText(option); radioButton.setId(i); if (getResponse().getText() != null && getResponse().getText().equals(i+"")) { radioButton.setChecked(true); } radioButton.setLayoutParams(new RadioGroup.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); mRadioGroup.addView(radioButton, i); } mRadioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { getResponse().setResponse(checkedId+""); } }); responseComponent.addView(mRadioGroup); }
@Override protected void beforeAddViewHook(ViewGroup questionComponent) { RadioButton radioButton = new RadioButton(getActivity()); final EditText otherText = new EditText(getActivity()); radioButton.setText(R.string.other_specify); radioButton.setTypeface(getInstrument().getTypeFace(getActivity().getApplicationContext())); final int otherId = getOptions().size(); radioButton.setId(otherId); radioButton.setLayoutParams(new RadioGroup.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); getRadioGroup().setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { if (checkedId == otherId) { otherText.setEnabled(true); otherText.requestFocus(); showKeyBoard(); } else { otherText.setEnabled(false); hideKeyBoard(); otherText.getText().clear(); } setResponseIndex(checkedId); } }); getRadioGroup().addView(radioButton, otherId); addOtherResponseView(otherText); questionComponent.addView(otherText); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_aknow_of_skills); addBackImage(R.drawable.back_pressed, null); addRightBtn("", null); setTitle(getString(R.string.SkincareKnowledge)); layout1 = findViewById(R.id.aknow_of_water); layout2 = findViewById(R.id.aknow_of_skin); layout1.setVisibility(View.VISIBLE); layout2.setVisibility(View.GONE); RadioGroup rgroup = (RadioGroup) findViewById(R.id.rGroup); rgroup.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(RadioGroup group, int checkedId) { switch (checkedId) { case R.id.rbLeft: layout1.setVisibility(View.VISIBLE); layout2.setVisibility(View.GONE); break; case R.id.rbRight: layout1.setVisibility(View.GONE); layout2.setVisibility(View.VISIBLE); break; default: break; } } }); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ronaldo = (ImageView) findViewById(R.id.imageView1); resize = (RadioGroup) findViewById(R.id.radioGroup1); resize.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup group, int checkedId) { // TODO Auto-generated method stub } }); resize.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup arg0, int arg1) { // TODO Auto-generated method stub switch (arg1) { case R.id.radio0: ronaldo.setLayoutParams(new RelativeLayout.LayoutParams(100, 100)); break; case R.id.radio1: ronaldo.setLayoutParams(new RelativeLayout.LayoutParams(200, 200)); break; case R.id.radio2: ronaldo.setLayoutParams(new RelativeLayout.LayoutParams(300, 300)); break; default: break; } } }); }