R.drawable.selected_right_background)); } else { femaleButton.setBackground(getResources().getDrawable( R.drawable.unselected_left_background)); maleButton.setBackground(getResources().getDrawable( R.drawable.selected_right_background)); R.drawable.unselected_right_background)); } else { femaleButton.setBackground(getResources().getDrawable( R.drawable.selected_left_background)); maleButton.setBackground(getResources().getDrawable( R.drawable.unselected_right_background));
radio.setTextColor(getResources().getColor(R.color.subject_select)); radio.setChecked(true); radio.setBackground(getResources().getDrawable(R.drawable.bg_bottom)); } else { radio.setTextColor(getResources().getColor(R.color.kViewztblack)); radio.setChecked(false); radio.setBackground(null);
newRadioButton.setBackground(selectorDrawable); else newRadioButton.setBackgroundDrawable(selectorDrawable);
@Override public void onCheckedChanged(RadioGroup group, int checkedId) { int radioButtonId = group.getCheckedRadioButtonId(); // 根据ID获取RadioButton的实例 RadioButton rb = (RadioButton) findViewById(radioButtonId); for (int i = 0; i < group.getChildCount(); i++) { RadioButton vradio = (RadioButton) group.getChildAt(i); vradio.setGravity(Gravity.CENTER); vradio.setPadding(20, 20, 20, 20); if (rb.getId() == vradio.getId()) { vradio.setTextColor(getResources().getColor(R.color.subject_select)); vradio.setChecked(true); vradio.setBackground(getResources().getDrawable(R.drawable.bg_bottom)); } else { vradio.setTextColor(getResources().getColor(R.color.kViewztblack)); vradio.setChecked(false); vradio.setBackground(null); } } // CustomProgress.show(mContext, true, null); kChartTimeInterval = titleList.get(checkedId - 1).get("time") + ""; indexMarketChart(); } });
mRadioButton.setButtonDrawable(mButtonDrawables != null ? mButtonDrawables.get(i, colorDrawable) : colorDrawable); if (Build.VERSION.SDK_INT >= 16) { mRadioButton.setBackground(getStateDrawable(i)); } else { mRadioButton.setBackgroundDrawable(getStateDrawable(i));
TintHelper.setTint(radioButton, color, isDark); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { radioButton.setBackground(null);