本文整理汇总了Java中android.widget.RadioGroup.check方法的典型用法代码示例。如果您正苦于以下问题:Java RadioGroup.check方法的具体用法?Java RadioGroup.check怎么用?Java RadioGroup.check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RadioGroup
的用法示例。
在下文中一共展示了RadioGroup.check方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import android.widget.RadioGroup; //导入方法依赖的package包/类
private void init(Context context) {
setOrientation(VERTICAL);
Resources r = context.getResources();
int pxPadding = (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, r.getDisplayMetrics());
setPadding(pxPadding, pxPadding, pxPadding, pxPadding);
LayoutInflater layoutInflater = LayoutInflater.from(context);
View view = layoutInflater.inflate(R.layout.menu_dialog, this);
mStreamEditText = (EditText) view.findViewById(R.id.stream_url);
mResolutionGroup = (RadioGroup)view.findViewById(R.id.resolution);
mResolutionGroup.check(R.id.resolution_hight);
mOrientationGroup = (RadioGroup)view.findViewById(R.id.orientation);
mOrientationGroup.check(R.id.orientation_landscape);
}
示例2: onCreateView
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public View onCreateView(
final LayoutInflater inflater,
final @Nullable ViewGroup container,
final @Nullable Bundle savedInstanceState) {
final View picker = inflater.inflate(R.layout.fragment_category_picker, container, false);
categories = (RadioGroup) picker.findViewById(R.id.categories);
categoryLabel = (TextView) picker.findViewById(R.id.selected_category);
categories.setOnCheckedChangeListener(new IconPickerWrapper(categoryLabel));
categories.check(R.id.other);
return picker;
}
示例3: onCreateView
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public View onCreateView(
final LayoutInflater inflater,
final @Nullable ViewGroup container,
final @Nullable Bundle savedInstanceState) {
final View picker = inflater.inflate(R.layout.fragment_category_picker, container, false);
categories = (RadioGroup) picker.findViewById(R.id.categories);
categoryLabel = (TextSwitcher) picker.findViewById(R.id.selected_category);
categories.setOnCheckedChangeListener(new IconPickerWrapper(categoryLabel));
categories.check(R.id.other);
return picker;
}
示例4: onCreate
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_capture_claim);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton attach = (FloatingActionButton) findViewById(R.id.attach);
attach.setOnClickListener(this);
selectedDate = new DatePickerWrapper((TextView) findViewById(R.id.date));
categories = (RadioGroup) findViewById(R.id.categories);
categories.setOnCheckedChangeListener(
new IconPickerWrapper((TextView) findViewById(R.id.selected_category))
);
categories.check(R.id.other);
}
示例5: onCheckedChanged
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if(group!=null && checkedId!=-1 && changeGroup==false){
for(int i=0;i<mRdoBtns.length;i++){
if(checkedId==mRdoBtns[i]){
mNewValue=mThemes[i];
group.check(mRdoBtns[i]);
persistInt(mNewValue);
getDialog().cancel();
}
}
}
}
示例6: onCreate
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_edit_issue);
mIssuename = (EditText) findViewById(R.id.IssueName);
mIssueDesc = (EditText) findViewById(R.id.descriptionTex);
mPosesrisk = (RadioGroup) findViewById(R.id.risk);
mImageView = (ImageView) findViewById(R.id.eventView);
mRisk = false;
mIssueAdapter = AdapterFactory.getInstance().getIssueAdapter(this);
Spinner categorySpinner = (Spinner) findViewById(R.id.nameCategorySpinner);
categorySpinner.setAdapter(new CategorySpinnerAdapter(getApplicationContext(),
R.layout.text_and_icon_spinner_tem));
categorySpinner.setSelection(categorySpinner.getCount());
Intent intent = getIntent();
Bundle data = intent.getBundleExtra(TAG_ISSUE);
mIssue = (Issue) data.getSerializable(TAG_ISSUE);
mIssuename.setText(mIssue.getTitle());
mIssueDesc.setText(mIssue.getDescription());
String url = mIssue.getPicture().getMedUrl();
Glide.with(this).load(url).into(mImageView);
Category[] categories = Category.values();
for (int i = 0; i < categories.length; ++i) {
if (mIssue.getCategory().equals(categories[i])) {
categorySpinner.setSelection(i);
}
}
if (mIssue.isRisk()) {
mPosesrisk.check(R.id.yes);
mRisk = true;
} else mPosesrisk.check(R.id.no);
Toolbar toolbar = (Toolbar) findViewById(R.id.create_issue_toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setTitle(getString(R.string.edit_issue));
mPosesrisk.setOnCheckedChangeListener(mRadioListener);
mPictureUpdated = false;
setupCloseKeyboard(findViewById(android.R.id.content));
}
示例7: onCreate
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_remind_fr);
/*findViewById(R.id.drf_cancel).setOnClickListener(this);
findViewById(R.id.drf_confirm).setOnClickListener(this);*/
RadioGroup rg = (RadioGroup) findViewById(R.id.remind_fr_buttons);
rg.check(map[fr]);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
for (int i = 0; i < map.length; i++) {
if (map[i] == checkedId) {
fr = i;
if (onResultListener != null) {
onResultListener.onResult(fr);
}
cancel();
return;
}
}
}
});
//取消按钮点击监听
TextView cancle = (TextView) findViewById(R.id.tv_cancel);
cancle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
RemindFrDialog.this.cancel();
}
});
((RadioButton) findViewById(R.id.remind_fr9)).setText(AssistUtils.translateRemindFrequency(9, date));
((RadioButton) findViewById(R.id.remind_fr10)).setText(AssistUtils.translateRemindFrequency(10, date));
}
示例8: onCreate
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_remind_fr);
intent=getIntent();
if(intent!=null){
type=intent.getIntExtra(TYPE, 0);
date.setTimeInMillis(intent.getLongExtra(DATE, System.currentTimeMillis()));
}
RadioGroup rg=(RadioGroup) findViewById(R.id.remind_fr_buttons);
rg.check(map[type]);
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
for(int i=0;i<map.length;i++){
if(map[i]==checkedId){
type=i;
return;
}
}
}
});
((RadioButton)findViewById(R.id.remind_fr9)).setText(AssistUtils.translateRemindFrequency(9,date));
((RadioButton)findViewById(R.id.remind_fr10)).setText(AssistUtils.translateRemindFrequency(10,date));
findViewById(R.id.arf_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(intent!=null){
intent.putExtra(TYPE, type);
setResult(FOR_FR, intent);
}
goBack();
}
});
}
示例9: initView
import android.widget.RadioGroup; //导入方法依赖的package包/类
private void initView() {
mHomeBtn = (RadioButton) findViewById(R.id.home_btn);
mExploreBtn = (RadioButton) findViewById(R.id.explore_btn);
mMineBtn = (RadioButton) findViewById(R.id.mine_btn);
mHomeBtn.setOnClickListener(this);
mExploreBtn.setOnClickListener(this);
mMineBtn.setOnClickListener(this);
mRadioGroup = (RadioGroup) findViewById(R.id.radioGroup);
mRadioGroup.check(R.id.home_btn);
}
示例10: onCheckedChanged
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
if (group != null && checkedId != -1 && changeGroup == false) {
for (int i = 0; i < mRdoBtns.length; i++) {
if (checkedId == mRdoBtns[i]) {
mNewValue = mThemes[i];
group.check(mRdoBtns[i]);
persistInt(mNewValue);
getDialog().cancel();
}
}
}
}
示例11: onCreateDialog
import android.widget.RadioGroup; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final LayoutInflater inflater = LayoutInflater.from(getActivity());
// Read button configuration
final Bundle args = getArguments();
final int index = args.getInt(ARG_INDEX);
final String command = args.getString(ARG_COMMAND);
final int eol = args.getInt(ARG_EOL);
final int iconIndex = args.getInt(ARG_ICON_INDEX);
final boolean active = true; // change to active by default
mActiveIcon = iconIndex;
// Create view
final View view = inflater.inflate(R.layout.feature_uart_dialog_edit, null);
final EditText field = mField = (EditText) view.findViewById(R.id.field);
final GridView grid = (GridView) view.findViewById(R.id.grid);
final CheckBox checkBox = mActiveCheckBox = (CheckBox) view.findViewById(R.id.active);
checkBox.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
field.setEnabled(isChecked);
grid.setEnabled(isChecked);
if (mIconAdapter != null)
mIconAdapter.notifyDataSetChanged();
}
});
final RadioGroup eolGroup = mEOLGroup = (RadioGroup) view.findViewById(R.id.uart_eol);
switch (Command.Eol.values()[eol]) {
case CR_LF:
eolGroup.check(R.id.uart_eol_cr_lf);
break;
case CR:
eolGroup.check(R.id.uart_eol_cr);
break;
case LF:
default:
eolGroup.check(R.id.uart_eol_lf);
break;
}
field.setText(command);
field.setEnabled(active);
checkBox.setChecked(active);
grid.setOnItemClickListener(this);
grid.setEnabled(active);
grid.setAdapter(mIconAdapter = new IconAdapter());
// As we want to have some validation we can't user the DialogInterface.OnClickListener as it's always dismissing the dialog.
final AlertDialog dialog = new AlertDialog.Builder(getActivity()).setCancelable(false).setTitle(R.string.uart_edit_title).setPositiveButton(R.string.ok, null)
.setNegativeButton(R.string.cancel, null).setView(view).show();
final Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
okButton.setOnClickListener(this);
return dialog;
}
示例12: onCreateView
import android.widget.RadioGroup; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.pay_way,container,false);
RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.payway);
//默认选中支付宝
radioGroup.check(R.id.paypal);
savePayway("Paypal");
radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
if(checkedId==R.id.paypal){
savePayway("PayPal");
}
else if(checkedId==R.id.alipay){
savePayway("AliPay");
}
else if(checkedId==R.id.wechat){
savePayway("Wechat Pay");
}
else if(checkedId==R.id.credit){
savePayway("Credit Card");
}
else{
savePayway("Bank Card");
}
}
});
return view;
}
示例13: checkTheme
import android.widget.RadioGroup; //导入方法依赖的package包/类
private void checkTheme(RadioGroup group, int checkedId){
for(int i=0;i<mRdoBtns.length;i++){
if(checkedId==mRdoBtns[i]){
saveTheme(i);
group.check(mRdoBtns[i]);
if(getDialog()!=null){
getDialog().cancel();
}
break;
}
}
}