当前位置: 首页>>代码示例>>Java>>正文


Java RadioButton.setText方法代码示例

本文整理汇总了Java中android.widget.RadioButton.setText方法的典型用法代码示例。如果您正苦于以下问题:Java RadioButton.setText方法的具体用法?Java RadioButton.setText怎么用?Java RadioButton.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.RadioButton的用法示例。


在下文中一共展示了RadioButton.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ZenModeConditionSelection

import android.widget.RadioButton; //导入方法依赖的package包/类
public ZenModeConditionSelection(Context context, int zenMode) {
    super(context);
    mContext = context;
    mZenMode = zenMode;
    mConditions = new ArrayList<Condition>();
    setLayoutTransition(new LayoutTransition());
    final int p = mContext.getResources().getDimensionPixelSize(R.dimen.content_margin_left);
    setPadding(p, p, p, 0);
    mNoMan = INotificationManager.Stub.asInterface(
            ServiceManager.getService(Context.NOTIFICATION_SERVICE));
    final RadioButton b = newRadioButton(null);
    b.setText(mContext.getString(com.android.internal.R.string.zen_mode_forever));
    b.setChecked(true);
    for (int i = ZenModeConfig.MINUTE_BUCKETS.length - 1; i >= 0; --i) {
        handleCondition(ZenModeConfig.toTimeCondition(mContext,
                ZenModeConfig.MINUTE_BUCKETS[i], UserHandle.myUserId()));
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:19,代码来源:ZenModeConditionSelection.java

示例2: getNavigatorButton

import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
public RadioButton getNavigatorButton(int position, ViewGroup parent) {
    RadioButton rb = (RadioButton) LayoutInflater.from(mContext).inflate(R.layout.radio_btn_segmented, parent, false);

    if (position == 0) {
        rb.setBackgroundResource(R.drawable.segmented_control_first);
    } else if (position == getCount() - 1) {
        rb.setBackgroundResource(R.drawable.segmented_control_last);
    } else {
        rb.setBackgroundResource(R.drawable.segmented_control);
    }

    rb.setText(getPageTitle(position));

    return rb;

}
 
开发者ID:KaneJinCN,项目名称:android-CategoryPager,代码行数:18,代码来源:SegmentedControlAdapter.java

示例3: makeRadioButton

import android.widget.RadioButton; //导入方法依赖的package包/类
private RadioButton makeRadioButton(RadioGroup baks, final String bk, final boolean item) {
    RadioButton bkb = new RadioButton(this);
    bkb.setText(bk);


    bkb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
            if (b) {
                selectedBackup = bk;
                selected = item;
                Log.d("backuppage", "selected = " + selectedBackup);
                backupSelected(selected);
            }
        }
    });

    baks.addView(bkb);
    return bkb;
}
 
开发者ID:quaap,项目名称:LaunchTime,代码行数:21,代码来源:BackupActivity.java

示例4: getView

import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    Log.d("TAG_GETVIEW","GETVIEW");
    if (convertView == null) {
        convertView = getLayoutInflater().inflate(R.layout.card, parent, false);
        this.mView = convertView;
    }
    ImageView head = (ImageView)convertView.findViewById(R.id.ques_image);
    Questions showed_question=mData.get(position);
    if (showed_question.getImagepath() != null) {
        //如果path == null,说明没有设置图片
        head.setScaleType(ImageView.ScaleType.CENTER_CROP);
        Bitmap bitmap = BitmapFactory.decodeFile(showed_question.getImagepath());
        head.setImageBitmap(bitmap);
    } else if (showed_question.getImageres()!= 0) {
        //考虑初始设置的十个将士的图片调用的是图片资源
        head.setScaleType(ImageView.ScaleType.CENTER_CROP);
        head.setImageResource(showed_question.getImageres());
    }
    RadioButton choose1=(RadioButton)convertView.findViewById(R.id.choose1);
    RadioButton choose2=(RadioButton)convertView.findViewById(R.id.choose2);
    RadioButton choose3=(RadioButton)convertView.findViewById(R.id.choose3);
    choose1.setText(showed_question.getName(0));
    choose2.setText(showed_question.getName(1));
    choose3.setText(showed_question.getName(2));
    buttons1[position] = choose1;
    buttons2[position] = choose2;
    buttons3[position] = choose3;
    return convertView;
}
 
开发者ID:wmgylc,项目名称:The-Three-kingdoms-Generals-Dictionary,代码行数:31,代码来源:GameActivity.java

示例5: bindType

import android.widget.RadioButton; //导入方法依赖的package包/类
private void bindType(int id, RuleInfo ri) {
    final RadioButton rb = (RadioButton) mTypes.findViewById(id);
    if (ri == null) {
        rb.setVisibility(View.GONE);
        return;
    }
    rb.setVisibility(View.VISIBLE);
    if (ri.caption != null) {
        rb.setText(ri.caption);
    }
    rb.setTag(ri);
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:13,代码来源:ZenRuleNameDialog.java

示例6: handleCondition

import android.widget.RadioButton; //导入方法依赖的package包/类
protected void handleCondition(Condition c) {
    if (mConditions.contains(c)) return;
    RadioButton v = (RadioButton) findViewWithTag(c.id);
    if (c.state == Condition.STATE_TRUE || c.state == Condition.STATE_UNKNOWN) {
        if (v == null) {
            v = newRadioButton(c);
        }
    }
    if (v != null) {
        v.setText(computeConditionText(c));
        v.setEnabled(c.state == Condition.STATE_TRUE);
    }
    mConditions.add(c);
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:15,代码来源:ZenModeConditionSelection.java

示例7: setSingleSelectItems

import android.widget.RadioButton; //导入方法依赖的package包/类
public void setSingleSelectItems(String[] singleSelectItems, int selectedItem, final OnClickListener onClickListener) {
    if (singleSelectItems != null && singleSelectItems.length > 0) {
        selectableItemsContainer.removeAllViews();
        selectableItemsContainer.setVisibility(View.VISIBLE);
        RadioGroup radioGroup = (RadioGroup) getLayoutInflater().inflate(R.layout.cfdialog_single_select_item_layout, selectableItemsContainer)
                                                                .findViewById(R.id.cfstage_single_select_radio_group);
        radioGroup.removeAllViews();
        for (int i = 0; i < singleSelectItems.length; i++) {
            String item = singleSelectItems[i];
            RadioButton radioButton = (RadioButton) getLayoutInflater().inflate(R.layout.cfdialog_single_select_radio_button_layout, null);
            radioButton.setText(item);
            radioButton.setId(i);
            final int position = i;
            if (position == selectedItem) {
                radioButton.setChecked(true);
            }
            radioButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                    if (isChecked && onClickListener != null) {
                        onClickListener.onClick(CFAlertDialog.this, position);
                    }
                }
            });
            radioGroup.addView(radioButton);
        }
    } else {
        selectableItemsContainer.setVisibility(View.GONE);
    }
}
 
开发者ID:Codigami,项目名称:CFAlertDialog,代码行数:31,代码来源:CFAlertDialog.java

示例8: 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);
        }
    }
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:35,代码来源:TestItemView.java

示例9: onCreateView

import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    // Inflate the layout for this fragment
    View layout = inflater.inflate(R.layout.welcome_account_fragment, container, false);
    if (mAccounts == null) {
        LOGD(TAG, "No accounts to display.");
        return null;
    }

    if (mActivity instanceof WelcomeFragmentContainer) {
        ((WelcomeFragmentContainer) mActivity).setPositiveButtonEnabled(false);
    }

    // Find the view
    RadioGroup accountsContainer = (RadioGroup) layout.findViewById(R.id.welcome_account_list);
    accountsContainer.removeAllViews();
    accountsContainer.setOnCheckedChangeListener(this);

    // Create the child views
    for (Account account : mAccounts) {
        LOGD(TAG, "Account: " + account.name);
        RadioButton button = new RadioButton(mActivity);
        button.setText(account.name);
        accountsContainer.addView(button);
    }

    return layout;
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:32,代码来源:AccountFragment.java

示例10: getRadioButton

import android.widget.RadioButton; //导入方法依赖的package包/类
@Override
public RadioButton getRadioButton(int position) {
    RadioButton button = (RadioButton) LayoutInflater.from(mContext).inflate(R.layout.emoji_radio_button, null);
    button.setText(getItem(position).icon);

    return button;
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:8,代码来源:EmojiRadioAdapter.java

示例11: updateRadioGroup

import android.widget.RadioButton; //导入方法依赖的package包/类
private void updateRadioGroup(String name){
    radioGroup = findViewById(R.id.radioGroup);
    RadioButton rb = new RadioButton(getApplicationContext());
    rb.setText(name);
    rb.setTextColor(Color.BLACK);
    radioGroup.addView(rb);
}
 
开发者ID:DJRAppDev,项目名称:QuizBowlApp,代码行数:8,代码来源:ChooseTeamActivity.java

示例12: setTextRadioButtonDate

import android.widget.RadioButton; //导入方法依赖的package包/类
private void setTextRadioButtonDate(RadioButton radioButtonDate, long date) {
    radioButtonDate.setText(OhaHelper.formatDate(date, "dd, MMM yyyy"));
}
 
开发者ID:brolam,项目名称:OpenHomeAnalysis,代码行数:4,代码来源:OhaEnergyUseBillFragment.java

示例13: 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;
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:47,代码来源:ViewFactory.java

示例14: 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);
    }
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:44,代码来源:BuzzerShieldSettings.java

示例15: addAnswer

import android.widget.RadioButton; //导入方法依赖的package包/类
private void addAnswer(String answer) {
  RadioButton radioButton = new RadioButton(getContext());
  radioButton.setText(answer);
  radioGroup.addView(radioButton);
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:6,代码来源:TestViewFragment.java


注:本文中的android.widget.RadioButton.setText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。