本文整理汇总了Java中android.widget.RadioButton.setOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java RadioButton.setOnClickListener方法的具体用法?Java RadioButton.setOnClickListener怎么用?Java RadioButton.setOnClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.RadioButton
的用法示例。
在下文中一共展示了RadioButton.setOnClickListener方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
Button endgame = (Button) findViewById(R.id.endgame);
endgame.setOnClickListener(ClickListener);
Spinner spinner = (Spinner) findViewById(R.id.sphofentries);
ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.hofentries_array , android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(ItemSelectedListener);
RadioButton rbclassic = (RadioButton) findViewById(R.id.rbclassic);
RadioButton rbletters = (RadioButton) findViewById(R.id.rbletters);
rbclassic.setOnClickListener(RadioListener);
rbletters.setOnClickListener(RadioListener);
prefs = new Preferences(this); // Instantiating Preferences in prefs global variable
spinner.setSelection(prefs.scoresnumpos);
if (prefs.notationstyle == "classic") {
rbclassic.setChecked(true);
rbletters.setChecked(false);
}
else if (prefs.notationstyle == "letters") {
rbclassic.setChecked(false);
rbletters.setChecked(true);
}
}
示例2: onCreate
import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fast_settings);
//Init checkboxes objects
globIntegrate = (CheckBox) findViewById(R.id.glob_integrate);
globProfileAlways = (RadioButton) findViewById(R.id.glob_profile_always);
globProfileWifi = (RadioButton) findViewById(R.id.glob_profile_wifi);
globProfileNever = (RadioButton) findViewById(R.id.glob_profile_never);
globGsm = (CheckBox) findViewById(R.id.glob_tg);
Button saveBtn = (Button) findViewById(R.id.save_bt);
saveBtn.setOnClickListener(this);
globProfileAlways.setOnClickListener(this);
globProfileNever.setOnClickListener(this);
globProfileWifi.setOnClickListener(this);
findViewById(R.id.row_glob_integrate).setOnClickListener(this);
findViewById(R.id.row_glob_profile_always).setOnClickListener(this);
findViewById(R.id.row_glob_profile_wifi).setOnClickListener(this);
findViewById(R.id.row_glob_profile_never).setOnClickListener(this);
findViewById(R.id.row_glob_tg).setOnClickListener(this);
updateFromPrefs();
}
示例3: onBindView
import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
protected void onBindView(final View view) {
super.onBindView(view);
mRadioButton = (RadioButton)view.findViewById(R.id.radio_button);
mRadioButton.setChecked(mIsSelected);
mRadioButton.setOnClickListener(mClickListener);
view.setOnClickListener(mClickListener);
}
示例4: initView
import android.widget.RadioButton; //导入方法依赖的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);
}
示例5: initView
import android.widget.RadioButton; //导入方法依赖的package包/类
private void initView()
{
mRbLeft = (RadioButton) findViewById(R.id.rbLeft);
mRbLeft.setOnClickListener(this);
mRbTop = (RadioButton) findViewById(R.id.rbTop);
mRbTop.setOnClickListener(this);
mRbRight = (RadioButton) findViewById(R.id.rbRight);
mRbRight.setOnClickListener(this);
mRbBottom = (RadioButton) findViewById(R.id.rbBottom);
mRbBottom.setOnClickListener(this);
mRbAuto = (RadioButton) findViewById(R.id.rbAuto);
mRbAuto.setOnClickListener(this);
mButton = (Button) findViewById(R.id.button);
mButton.setOnClickListener(this);
mButton2 = (Button) findViewById(R.id.button2);
mButton2.setOnClickListener(this);
mButton3 = (Button) findViewById(R.id.button3);
mButton3.setOnClickListener(this);
mButton4 = (Button) findViewById(R.id.button4);
mButton4.setOnClickListener(this);
mButton5 = (Button) findViewById(R.id.button5);
mButton5.setOnClickListener(this);
mButton6 = (Button) findViewById(R.id.button6);
mButton6.setOnClickListener(this);
mButton7 = (Button) findViewById(R.id.button7);
mButton7.setOnClickListener(this);
mButton8 = (Button) findViewById(R.id.button8);
mButton8.setOnClickListener(this);
mButton9 = (Button) findViewById(R.id.button9);
mButton9.setOnClickListener(this);
mButton10 = (Button) findViewById(R.id.button10);
mButton10.setOnClickListener(this);
mButton11 = (Button) findViewById(R.id.button11);
mButton11.setOnClickListener(this);
mButton12 = findViewById(R.id.button12);
mButton12.setOnClickListener(this);
mCheckBoxThrough = findViewById(R.id.checkBoxThrough);
}
示例6: initializeAndGetButton
import android.widget.RadioButton; //导入方法依赖的package包/类
/**
* Initiatializes a Button and selects it if it corresponds to the current
* theme.
*/
private RadioButton initializeAndGetButton(int id, final Theme theme) {
final RadioButton button = (RadioButton) findViewById(id);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mDistilledPagePrefs.setTheme(theme);
}
});
return button;
}
示例7: initCheckGroup
import android.widget.RadioButton; //导入方法依赖的package包/类
private void initCheckGroup(final OrderTestModel.OrderItemCheckListBean model, LayoutInflater inflater) {
for (int z = 0; z < model.checkItemSuggestions.size(); z++) {
final OrderTestModel.OrderItemCheckListBean.CheckItemSuggestionsBean item = model.checkItemSuggestions.get(z);
// final RadioButton ckview = (RadioButton)inflater.inflate(R.layout.fragment_test_item_ck, null);
final RadioButton ckview = new RadioButton(activity);
ckview.setText(item.suggestionOption);
if (item.isChecked.equals("1")) {
checkId = item.checkItemSuggestionsId;
ckview.setChecked(true);
} else {
ckview.setChecked(false);
}
ckview.setTag(item.checkItemSuggestionsId);
ckview.setTextColor(this.getResources().getColor(R.color.gray_text));
ckview.setButtonDrawable(new ColorDrawable(Color.TRANSPARENT));
ckview.setTextSize(18);
ckview.setId(z);
ckview.setPadding(2, 0, 12, 0);
ckview.setGravity(Gravity.CENTER | left);
Drawable drawable = getResources().getDrawable(
R.drawable.checkbox_selector_circle_bac);
// 这一步必须要做,否则不会显示.
drawable.setBounds(0, 0, drawable.getMinimumWidth(),
drawable.getMinimumHeight());
ckview.setCompoundDrawables(drawable, null, null, null);
ckview.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
checkId = (String) ckview.getTag();
}
});
llsugestcontain.addView(ckview);
}
}
示例8: 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);
}
});
}
示例9: 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;
}
示例10: onCreateView
import android.widget.RadioButton; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_expense, container, false);
rbExpense = (RadioButton) view.findViewById(R.id.rb_expense);
rbIncome = (RadioButton) view.findViewById(R.id.rb_income);
rcvView = (RecyclerView) view.findViewById(R.id.rcv_view);
scrollView = (MySrollView) view.findViewById(R.id.scroll);
ivTitleIcon = (ImageView) view.findViewById(R.id.iv_title_icon);
tvTitleText = (TextView) view.findViewById(tv_title_text);
tvAccountNum = (TextView) view.findViewById(R.id.tv_account_num);
llBottom = (LinearLayout) view.findViewById(R.id.ll_bottom);
moneyText = (TextView) view.findViewById(R.id.tv_account_num);
moneyWindow = (LinearLayout) view.findViewById(R.id.have_chosen);
plInput = (PercentRelativeLayout) view.findViewById(R.id.input_board);
llSidebar = (LinearLayout) view.findViewById(R.id.calculator_sidebar);
view.findViewById(R.id.one).setOnClickListener(this);
view.findViewById(R.id.two).setOnClickListener(this);
view.findViewById(R.id.three).setOnClickListener(this);
view.findViewById(R.id.four).setOnClickListener(this);
view.findViewById(R.id.five).setOnClickListener(this);
view.findViewById(R.id.six).setOnClickListener(this);
view.findViewById(R.id.seven).setOnClickListener(this);
view.findViewById(R.id.eight).setOnClickListener(this);
view.findViewById(R.id.nine).setOnClickListener(this);
view.findViewById(R.id.zero).setOnClickListener(this);
view.findViewById(R.id.clear).setOnClickListener(this);
view.findViewById(R.id.dot).setOnClickListener(this);
view.findViewById(R.id.add_finish).setOnClickListener(this);
etDes = (EditText) view.findViewById(R.id.et_des);
llBanner = (LinearLayout) view.findViewById(R.id.calculator_banner);
rbExpense.setOnClickListener(this);
rbIncome.setOnClickListener(this);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), 4);
gridLayoutManager.setOrientation(GridLayoutManager.VERTICAL);
rcvView.setLayoutManager(gridLayoutManager);
initData();
return view;
}
示例11: onCreate
import android.widget.RadioButton; //导入方法依赖的package包/类
/**
* Called when the activity is first created. Creates the user interface for
* the settings.
*
* @param savedInstanceState
* It is used to save the state of the created Activity.
*
* @author Yuriy Stanchev
*
* @email [email protected]
*
* @date 11 Mar 2012
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.settings);
/*
* Assign the text views to the corresponding elements in the layout
*/
sound = (CheckBox) findViewById(R.id.sound);
vibration = (CheckBox) findViewById(R.id.vibrate);
easy = (RadioButton) findViewById(R.id.easy);
normal = (RadioButton) findViewById(R.id.normal);
hard = (RadioButton) findViewById(R.id.hard);
human = (RadioButton) findViewById(R.id.human);
back = (Button) findViewById(R.id.back);
/*
* Set the Click Listeners so we can switch on and off the settings
*/
sound.setOnClickListener(this);
vibration.setOnClickListener(this);
easy.setOnClickListener(this);
normal.setOnClickListener(this);
hard.setOnClickListener(this);
human.setOnClickListener(this);
back.setOnClickListener(this);
/*
* Get the settings state.
*/
getSettings();
/*
* Set the settings.
*/
setText();
}
示例12: initView
import android.widget.RadioButton; //导入方法依赖的package包/类
private void initView() {
final RadioGroup group = (RadioGroup) getView().findViewById(
R.id.ringtoneGroup);
RingtoneManager manager = new RingtoneManager(getActivity());
manager.setType(RingtoneManager.TYPE_RINGTONE);
int pdng = (int) (5 * getResources().getDisplayMetrics().density + .5f);
final String[] columns = {MediaStore.Images.Media.DATA,
MediaStore.Audio.Media._ID};
final String orderBy = MediaStore.Images.Media._ID;
Cursor imagecursor = getActivity().getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, columns, null,
null, orderBy);
int dataColumnIndex = imagecursor
.getColumnIndex(MediaStore.Audio.Media.DATA);
for (int i = 0; i < imagecursor.getCount(); i++) {
imagecursor.moveToPosition(i);
final String uri = imagecursor.getString(dataColumnIndex);
final String title = uri.substring(uri.lastIndexOf("/") + 1);
RadioButton rb = new RadioButton(getActivity());
rb.setLayoutParams(new RadioGroup.LayoutParams(
RadioGroup.LayoutParams.MATCH_PARENT,
RadioGroup.LayoutParams.WRAP_CONTENT));
rb.setText(title);
rb.setTypeface(((OneSheeldApplication) getActivity()
.getApplication()).appFont);
rb.setGravity(Gravity.CENTER);
rb.setPadding(pdng, pdng, pdng, pdng);
rb.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
rb.setTextColor(getResources().getColor(R.color.textColorOnDark));
rb.setBackgroundResource(R.drawable.devices_list_item_selector);
rb.setTag(uri);
rb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
((OneSheeldApplication) getActivity().getApplication())
.setBuzzerSound(uri);
}
});
group.addView(rb);
}
}
示例13: DialogPlotSettings
import android.widget.RadioButton; //导入方法依赖的package包/类
public DialogPlotSettings(Activity context, PlotPropertiesChangeIf changeIf, PlotProperties parameters)
{
super(context, R.layout.dialog_plot_settings, R.string.dialog_plot_settings_title);
this.parameters = parameters;
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;
((LinearLayout) findViewById(R.id.dialog_dimension_layout))
.setVisibility((changeIf.getDimension() == PlotPropertiesChangeIf.Dimension.TWO_D) ? View.VISIBLE
: View.GONE);
if (changeIf.getDimension() == PlotPropertiesChangeIf.Dimension.TWO_D)
{
rContour = (RadioButton) findViewById(R.id.dialog_button_contour);
rContour.setOnClickListener(this);
rSurface = (RadioButton) findViewById(R.id.dialog_button_surface);
rSurface.setOnClickListener(this);
switch (parameters.twoDPlotStyle)
{
case CONTOUR:
rContour.setChecked(true);
onClick(rContour);
break;
case SURFACE:
rSurface.setChecked(true);
onClick(rSurface);
break;
}
cbMeshLines = (CheckBox) findViewById(R.id.dialog_checkbox_mesh_lines);
cbMeshLines.setChecked(parameters.meshLines);
cbMeshFill = (CheckBox) findViewById(R.id.dialog_checkbox_mesh_fill);
cbMeshFill.setChecked(parameters.meshFill);
pickerMeshOpacity = (OpacityBar) findViewById(R.id.dialog_colorpicker_mesh_opacity);
pickerMeshOpacity.setColor(Color.BLACK);
pickerMeshOpacity.setOpacity(parameters.meshOpacity);
pickerRotation = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_rotation);
pickerRotation.setValue(parameters.rotation);
pickerRotation.minValue = 0;
pickerRotation.maxValue = 360;
pickerElevation = (HorizontalNumberPicker) findViewById(R.id.dialog_picker_elevation);
pickerElevation.setValue(parameters.elevation);
pickerElevation.minValue = 0;
pickerElevation.maxValue = 360;
}
switch (parameters.axesStyle)
{
case BOXED:
((RadioButton) findViewById(R.id.dialog_button_axes_boxed)).setChecked(true);
break;
case CROSSED:
((RadioButton) findViewById(R.id.dialog_button_axes_crossed)).setChecked(true);
break;
case NONE:
((RadioButton) findViewById(R.id.dialog_button_axes_none)).setChecked(true);
break;
}
this.changeIf = changeIf;
}