本文整理匯總了Java中android.widget.RadioGroup類的典型用法代碼示例。如果您正苦於以下問題:Java RadioGroup類的具體用法?Java RadioGroup怎麽用?Java RadioGroup使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RadioGroup類屬於android.widget包,在下文中一共展示了RadioGroup類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findSelectedDuration
import android.widget.RadioGroup; //導入依賴的package包/類
public int findSelectedDuration(View view) {
RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.stroke_dlg_duration_group);
int radioButtonId = radioGroup.getCheckedRadioButtonId();
if( radioButtonId != -1 ) {
RadioButton radioButton = (RadioButton) radioGroup.findViewById(radioButtonId);
if( radioButton != null ) {
return ((Integer)radioButton.getTag()).intValue();
}
}
return 0;
}
示例2: setUserProperty
import android.widget.RadioGroup; //導入依賴的package包/類
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;
}
}
});
}
示例3: riskButtonListener
import android.widget.RadioGroup; //導入依賴的package包/類
public void riskButtonListener(View v) {
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.radio_group);
RadioButton radioButton = (RadioButton) findViewById(R.id.radio_yes);
TextView message = (TextView) findViewById(R.id.risk_validation);
if (radioGroup.getCheckedRadioButtonId() != -1) {
message.setVisibility(View.INVISIBLE);
mRisk = radioGroup.getCheckedRadioButtonId()
== radioButton.getId();
nextPage();
} else {
message.setVisibility(View.VISIBLE);
}
}
示例4: onViewCreated
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
mRadioGroup = (RadioGroup) view.findViewById(R.id.radio_group);
mShowAllButton = (RadioButton) view.findViewById(R.id.show_all);
mRedactSensitiveButton = (RadioButton) view.findViewById(R.id.redact_sensitive);
mRadioGroup.setOnCheckedChangeListener(this);
// Disable buttons according to policy.
if (isSecureNotificationsDisabled(getActivity())) {
mShowAllButton.setEnabled(false);
mRedactSensitiveButton.setEnabled(false);
} else if (isUnredactedNotificationsDisabled(getActivity())) {
mShowAllButton.setEnabled(false);
}
}
示例5: initHistoryData
import android.widget.RadioGroup; //導入依賴的package包/類
private void initHistoryData(List<String> allNames) {
int padding = (int) (DensityUtil.dip2px(10f) * DensityUtil.getBaseScale(getContext()));
TagAdapter adapter = new TagAdapter<String>(allNames) {
@Override
public View getView(FlowLayout parent, int position, String s) {
TextView textView = new TextView(getContext());
textView.setLayoutParams(new RadioGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
textView.setWidth((int) (DensityUtil.dip2px(80f) * DensityUtil.getBaseScale(getContext())));
textView.setLines(1);
textView.setGravity(Gravity.CENTER);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setPadding(padding, padding, padding, padding);
textView.setText(s);
return textView;
}
};
mBinding.flowLayoutHistory.setAdapter(adapter);
mBinding.flowLayoutHistory.setOnTagClickListener((view, position, parent) -> {
String item = (String) adapter.getItem(position);
return false;
});
}
示例6: onCreate
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityManager.getActivityManager().addActivity("RegisterActivity", this);
setContentView(R.layout.activity_register);
etName = (EditText) findViewById(R.id.ETname);
etEmail = (EditText) findViewById(R.id.ETemail);
spMajor = (Spinner) findViewById(R.id.spiMajor);
spProvince = (Spinner) findViewById(R.id.spiProvince);
etPassword = (EditText) findViewById(R.id.ETpassword);
etConfirmPassword = (EditText) findViewById(R.id.ETconfirmPassword);
etCheckCode = (EditText) findViewById(R.id.ETCheckCode);
radioGroup = (RadioGroup) findViewById(R.id.rgGender);
findViewById(R.id.butRegister).setOnClickListener(this);
findViewById(R.id.butMailCode).setOnClickListener(this);
}
示例7: onCheckedChanged
import android.widget.RadioGroup; //導入依賴的package包/類
/**
* 最下方,點擊切換Fragment的管理
*/
// @OnCheckedChanged({R.id.rb_news, R.id.rb_jingxuan, R.id.rb_forum, R.id.rb_my})
//void onTagChecked(RadioButton rbFragment) {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_news:
//LogUtils.i("MainActivity onTagChecked() 資訊");
replaceOutFragment(mNewsFragment);
break;
case R.id.rb_jingxuan:
//LogUtils.i("MainActivity onTagChecked() 精選");
replaceOutFragment(mJingXuanFragment);
break;
case R.id.rb_forum:
//LogUtils.i("MainActivity onTagChecked() 社區");
replaceOutFragment(mForumFragment);
break;
case R.id.rb_my:
//LogUtils.i("MainActivity onTagChecked() 我");
replaceOutFragment(mMeFragment);
break;
}
}
示例8: initData
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
protected void initData() {
mOrderNo = getIntent().getStringExtra("orderNo");
mPayType = getIntent().getStringExtra("payType");
mPayTypeComments = getIntent().getStringExtra("payTypeComments");
mTextView_Number.setText(mOrderNo);
mRadioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
if (mRadioButton_Alipay.getId() == checkedId) {
PAY_TYPE = 0;
}
if (mRadioButton_Balance.getId() == checkedId) {
PAY_TYPE = 1;
}
}
});
mPresenter.payVerifyResult(1, mOrderNo,new ArrayMap<>());
}
示例9: onCreate
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dialog_alarm_item);
ButterKnife.bind(this);
fillMap();
mAlarmItemBtns.check(itemMaps.get(mAlarmItem));
mAlarmItemBtns.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
RadioButton selectedBtn = (RadioButton) findViewById(checkedId);
mAlarmItem = selectedBtn.getText().toString();
if (mSelectedListener != null)
mSelectedListener.onSelected(mAlarmItem);
dismiss();
}
});
}
示例10: onCheckedChanged
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
switch (checkedId) {
case R.id.rb_black:
presenter.setSortingMode(SortingMode.BLACK);
presenter.hideColorSeekBar();
break;
case R.id.rb_white:
presenter.setSortingMode(SortingMode.WHITE);
presenter.hideColorSeekBar();
break;
case R.id.rb_brightness:
presenter.setSortingMode(SortingMode.BRIGHTNESS);
presenter.hideColorSeekBar();
break;
case R.id.rb_color:
presenter.setSortingMode(SortingMode.COLOR);
presenter.showColorSeekBar();
break;
}
}
示例11: onCreate
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.e("MainActivity", "onCreate!!!!!");
MyApplication.activity = this;
SingletonData.getInstance();
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.tabcontroller);
isFang = getIntent().getExtras().getString("isFang");
int tranId = R.id.firstContentTab;
if (isFang != null && isFang.equals("true")) {
tranId = R.id.fangYaoTab;
}
// mContainer = (ViewGroup) findViewById(R.id.content);
fragmentManager = getFragmentManager();
radioGroup = (RadioGroup) findViewById(R.id.rg_tab);
radioGroup.check(tranId);
radioGroup.setVisibility(ViewGroup.GONE);
FragmentTransaction transaction = fragmentManager.beginTransaction();
Fragment fragment = FragmentFactory
.getInstanceByIndex(tranId);
transaction.replace(R.id.content, fragment);
transaction.commit();
}
示例12: 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;
}
示例13: onCreate
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText = findViewById(R.id.et);
((RadioGroup) findViewById(R.id.rg)).setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, @IdRes int checkedId) {
switch (checkedId) {
case R.id.vod:
isLive = false;
break;
case R.id.live:
isLive = true;
break;
}
}
});
//用於將視頻緩存到SDCard,如不授權將緩存到/data/data目錄
if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1001);
}
}
示例14: 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);
}
示例15: initViews
import android.widget.RadioGroup; //導入依賴的package包/類
@Override
public void initViews() {
mLayoutRoot = (LinearLayout) findViewById(R.id.dialog_publish_layout_root);
mPubHelptv = (HandyTextView)findViewById(R.id.publish_help_textview);
mRgPubDay = (RadioGroup)findViewById(R.id.dialog_publish_rg_day);
mPubStartHtv = (HandyTextView)findViewById(R.id.publish_start_time_hour);
mPubStartMtv = (HandyTextView)findViewById(R.id.publish_start_time_minute);
mPubEndHtv = (HandyTextView)findViewById(R.id.publish_end_time_hour);
mPubEndMtv = (HandyTextView)findViewById(R.id.publish_end_time_minute);
edtTxt_details = (EditText)findViewById(R.id.pubish_ps_textview);
mBtnSubmit = (Button) findViewById(R.id.dialog_publish_btn_submit);
mBtnCancel = (Button) findViewById(R.id.dialog_publish_btn_cancel);
details_linearLayout = (LinearLayout) findViewById(R.id.pop_pub_details_linearLayout);
// if(!relation){
// details_linearLayout.setVisibility(View.GONE);
// } else {
// details_linearLayout.setVisibility(View.VISIBLE);
// }
}