本文整理汇总了Java中android.widget.RadioButton.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Java RadioButton.setChecked方法的具体用法?Java RadioButton.setChecked怎么用?Java RadioButton.setChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RadioButton
的用法示例。
在下文中一共展示了RadioButton.setChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
final ViewGroup nullParent = null;
convertView = mLayoutInflater.inflate(R.layout.iconpack_dialog, nullParent);
}
IconPackInfo info = mSupportedPackages.get(position);
TextView txtView = convertView.findViewById(R.id.title);
txtView.setText(info.label);
ImageView imgView = convertView.findViewById(R.id.icon);
imgView.setImageDrawable(info.icon);
RadioButton radioButton = convertView.findViewById(R.id.radio);
radioButton.setChecked(info.packageName.equals(mCurrentIconPack));
return convertView;
}
示例2: createDialog
import android.widget.RadioButton; //导入方法依赖的package包/类
public Dialog createDialog() {
View root = LayoutInflater.from(getContext()).inflate(R.layout.cast_mode_dialog, null);
mStreamButton = (RadioButton) root.findViewById(R.id.cast_stream_button);
mRadioGroup = (RadioGroup)root.findViewById(R.id.radio_group);
mRemoteDisplayButton = (RadioButton) root.findViewById(R.id.cast_remote_button);
if(ArchosVideoCastManager.getInstance().isRemoteDisplayConnected())
mRemoteDisplayButton.setChecked(true);
else
mStreamButton.setChecked(true);
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int i) {
if(i==R.id.cast_stream_button)
ArchosVideoCastManager.getInstance().switchToVideoCast();
else
ArchosVideoCastManager.getInstance().switchToDisplayCast();
mDialog.dismiss();
}
});
mDialog = new AlertDialog.Builder(getContext()).setView(root).create();
return mDialog;
}
示例3: setChecked
import android.widget.RadioButton; //导入方法依赖的package包/类
private void setChecked(boolean checked) {
if (mView != null) {
RadioButton radio = (RadioButton)mView.findViewById(R.id.radio_button);
if (radio != null) {
radio.setChecked(checked);
}
}
}
示例4: initSelectedRadioBtn
import android.widget.RadioButton; //导入方法依赖的package包/类
private void initSelectedRadioBtn(View view){
for(int i=0;i<mThemes.length;i++){
if(Constans.theme==mThemes[i]){
RadioButton radioButton=(RadioButton)view.findViewById(mRdoBtns[i]);
radioButton.setChecked(true);
break;
}
}
}
示例5: DialogImageSettings
import android.widget.RadioButton; //导入方法依赖的package包/类
public DialogImageSettings(AppCompatActivity activity, ImagePropertiesChangeIf changeIf, ImageProperties parameters)
{
super(activity, R.layout.dialog_image_settings, R.string.dialog_image_settings_title);
this.activity = activity;
this.parameters = parameters;
fileName = (EditText) findViewById(R.id.dialog_file_name);
if (parameters.fileName != null)
{
fileName.setText(parameters.fileName);
}
buttonSelectFile = (ImageButton) findViewById(R.id.dialog_button_select_file);
buttonSelectFile.setOnClickListener(this);
buttonSelectFile.setOnLongClickListener(this);
ViewUtils.setImageButtonColorAttr(activity, buttonSelectFile, R.attr.colorDialogContent);
cbEmbedded = (CheckBox) findViewById(R.id.dialog_checkbox_embedded);
cbEmbedded.setChecked(parameters.embedded);
pickerWidth = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_width);
pickerWidth.setValue(parameters.width);
pickerWidth.minValue = 0;
pickerHeight = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_height);
pickerHeight.setValue(parameters.height);
pickerHeight.minValue = 0;
rOriginalSize = (RadioButton) findViewById(R.id.dialog_button_original_size);
rOriginalSize.setOnClickListener(this);
rOriginalSize.setChecked(parameters.originalSize);
rCustomSize = (RadioButton) findViewById(R.id.dialog_button_custom_size);
rCustomSize.setOnClickListener(this);
rCustomSize.setChecked(!parameters.originalSize);
onClick(parameters.originalSize ? rOriginalSize : rCustomSize);
this.changeIf = changeIf;
}
示例6: fillHarmonic
import android.widget.RadioButton; //导入方法依赖的package包/类
public void fillHarmonic(final View view, final int id, final int value, int selection, boolean enabled) {
RadioButton radioButton = (RadioButton)view.findViewById(id);
radioButton.setTag(Integer.valueOf(value));
radioButton.setChecked(value == selection);
radioButton.setEnabled(enabled);
radioButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
fillData(view, value, 0);
}
});
}
示例7: onCreateView
import android.widget.RadioButton; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
Log.i(TAG, "onCreateView");
customView = inflater.inflate(R.layout.home_fragment_slidebar_schedule, container, false);
progressBar = (RelativeLayout) customView.findViewById(R.id.progressbar_schedule);
scheduleRecyclerView = (RecyclerView)
customView.findViewById(R.id.shedule_recyclerview);
radioButtonToday = (RadioButton) customView.findViewById(schedule_today_rb);
radioButtonTomorrow = (RadioButton) customView.findViewById(schedule_tomorrow_rb);
radioButtonAll = (RadioButton) customView.findViewById(schedule_all_rb);
radioGroup = (RadioGroup) customView.findViewById(R.id.radio_group_schedule);
txtMsgNoContent = (TextView) customView.findViewById(R.id.message_label_sc);
handler = new Handler(getActivity().getMainLooper());
radioGroup.setOnCheckedChangeListener(this);
if(schedule_all_rb == rbSelectedId)
radioButtonAll.setChecked(true);
if(schedule_today_rb == rbSelectedId)
radioButtonToday.setChecked(true);
if(schedule_tomorrow_rb == rbSelectedId)
radioButtonTomorrow.setChecked(true);
progressBar.setVisibility(View.VISIBLE);
txtMsgNoContent.setVisibility(View.INVISIBLE);
scheduleRecyclerView.setVisibility(View.INVISIBLE);
init();
return customView;
}
示例8: fillDynamic
import android.widget.RadioButton; //导入方法依赖的package包/类
public void fillDynamic(View view, int id, int value, int selection) {
RadioButton radioButton = (RadioButton)view.findViewById(id);
radioButton.setTag(Integer.valueOf(value));
radioButton.setChecked(value == selection);
}
示例9: getRadios
import android.widget.RadioButton; //导入方法依赖的package包/类
private static View getRadios(Activity activity, LayoutInflater inflater, final SignUpEventOptions options) {
View view = inflater.inflate(R.layout.event_sign_up_radios, null);
((TextView) view.findViewById(R.id.tv_label)).setText(options.getLabel() + (options.isRequired() ? "" : "(选填)") + ":");
RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.rg_options);
RadioGroup.LayoutParams params = new RadioGroup.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMarginEnd(100);
if (!TextUtils.isEmpty(options.getOption())) {
String[] list = options.getOption().split(";");
String[] status = null;
if (!TextUtils.isEmpty(options.getOptionStatus()))
status = options.getOptionStatus().split(";");
for (int i = 0; i < list.length; i++) {
RadioButton button = new RadioButton(activity);
button.setLayoutParams(params);
button.setText(list[i]);
if (!TextUtils.isEmpty(options.getDefaultValue())) {
button.setChecked(list[0].equals(options.getDefaultValue()));
options.setValue(options.getDefaultValue());
} else {
button.setChecked(i == 0);
options.setValue(list[0]);
}
boolean enable;
if (status == null)
enable = true;
else if (status.length <= i)
enable = true;
else
enable = "0".equals(status[0]);
button.setId(i);
button.setEnabled(enable);
radioGroup.addView(button);
}
}
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
String s[] = options.getOption().split(";");
if (s != null)
options.setValue(s[checkedId]);
}
});
return view;
}
示例10: fillOption
import android.widget.RadioButton; //导入方法依赖的package包/类
public void fillOption(View view, int id, Integer value, boolean selected) {
RadioButton radioButton = (RadioButton)view.findViewById(id);
radioButton.setTag(Integer.valueOf(value));
radioButton.setChecked(selected);
}
示例11: updateRadio
import android.widget.RadioButton; //导入方法依赖的package包/类
public void updateRadio(RadioButton button, Integer value, Integer selection) {
button.setTag(Integer.valueOf(value));
button.setChecked(selection != null && selection.equals(value));
}
示例12: fillDuration
import android.widget.RadioButton; //导入方法依赖的package包/类
public void fillDuration(View view, int id, int value, int selection) {
RadioButton radioButton = (RadioButton)view.findViewById(id);
radioButton.setTag(Integer.valueOf(value));
radioButton.setChecked(value == selection);
}
示例13: onStart
import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
public void onStart() {
super.onStart();
mPatternRadioButton = (RadioButton) getDialog().findViewById(R.id.pattern_radio_button);
mInterfaceRadioButton = (RadioButton) getDialog().findViewById(R.id.interface_radio_button);
mGlobalRadioButton = (RadioButton) getDialog().findViewById(R.id.global_radio_button);
mLocalRadioButton = (RadioButton) getDialog().findViewById(R.id.local_radio_button);
mIncludeRadioButton = (RadioButton) getDialog().findViewById(R.id.include_radio_button);
mExcludeRadioButton = (RadioButton) getDialog().findViewById(R.id.exclude_radio_button);
mPatternEditText = (EditText) getDialog().findViewById(R.id.pattern_text_edit);
mDescriptionTextView = (TextView) getDialog().findViewById(R.id.description_text_view);
mDescriptionTextView.setText(Html.fromHtml(getString(R.string.pattern_filter__description_html)));
SharedPreferences sharedPref = getContext().getSharedPreferences(
getString(R.string.pattern_filter__shared_preferences), Context.MODE_PRIVATE);
boolean isPattern = sharedPref.getBoolean(getString(R.string.pattern_filter__shared_preferences_pattern_checked), true);
boolean isInterface = sharedPref.getBoolean(getString(R.string.pattern_filter__shared_preferences_interface_checked), false);
boolean isGlobal = sharedPref.getBoolean(getString(R.string.pattern_filter__shared_preferences_global_checked), true);
boolean isLocal = sharedPref.getBoolean(getString(R.string.pattern_filter__shared_preferences_local_checked), false);
boolean isInclude = sharedPref.getBoolean(getString(R.string.pattern_filter__shared_preferences_include_checked), true);
boolean isExclude = sharedPref.getBoolean(getString(R.string.pattern_filter__shared_preferences_exclude_checked), false);
if (mOldFilter != null) {
if (mOldFilter instanceof PatternFilter) {
PatternFilter filter = (PatternFilter) mOldFilter;
isPattern = true;
isInterface = false;
isGlobal = true;
isLocal = false;
isInclude = filter.getType() == PatternFilter.Type.INCLUDE;
isExclude = !isInclude;
mPatternEditText.setText(filter.getPattern().toString());
}
if (mOldFilter instanceof LocalPatternFilter) {
isGlobal = false;
isLocal = true;
}
if (mOldFilter instanceof InterfaceFilter) {
isPattern = false;
isInterface = true;
}
if (mOldFilter instanceof LocalInterfaceFilter) {
isGlobal = false;
isLocal = true;
}
}
mPatternRadioButton.setChecked(isPattern);
mInterfaceRadioButton.setChecked(isInterface);
mGlobalRadioButton.setChecked(isGlobal);
mLocalRadioButton.setChecked(isLocal);
mIncludeRadioButton.setChecked(isInclude);
mExcludeRadioButton.setChecked(isExclude);
}
示例14: SetRadioButton
import android.widget.RadioButton; //导入方法依赖的package包/类
void SetRadioButton(int id) {
RadioButton rb = (RadioButton) findViewById(id);
rb.setChecked(true);
}
示例15: fillTransition
import android.widget.RadioButton; //导入方法依赖的package包/类
public void fillTransition(View view, int id, int value, int selection) {
RadioButton radioButton = (RadioButton)view.findViewById(id);
radioButton.setTag(Integer.valueOf(value));
radioButton.setChecked(value == selection);
}