Java Code Examples for android.support.v7.widget.AppCompatRadioButton#setTextSize()

The following examples show how to use android.support.v7.widget.AppCompatRadioButton#setTextSize() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SingleChooseDialog.java    From AssistantBySDK with Apache License 2.0 6 votes vote down vote up
private void init() {
    mRgChoice.setVisibility(View.VISIBLE);
    mChoiceBox.setVisibility(View.GONE);
    mScdTitle.setText(title);
    for (int i = 0; i < datas.length; i++) {
        AppCompatRadioButton arb = new AppCompatRadioButton(mContext);
        ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(-1, ScreenUtil.getInstance().dip2px(48));
        arb.setLayoutParams(layoutParams);
        arb.setGravity(Gravity.CENTER_VERTICAL);
        arb.setId(i);
        arb.setText(datas[i]);
        arb.setTextSize(15);
        arb.setTextColor(mContext.getResources().getColor(R.color.new_text_color_first));
        arb.setPadding(ScreenUtil.getInstance().dip2px(16), 0, 0, 0);
        if (i == 0)
            arb.setChecked(true);
        mRgChoice.addView(arb);
    }
}
 
Example 2
Source File: DialogLPV.java    From LockPattern with MIT License 5 votes vote down vote up
private void setQuestionItem(int pos, AppCompatRadioButton rb, ViewGroup.LayoutParams lp,
                             ColorStateList csl){
    rb.setLayoutParams(lp);
    rb.setTag(pos);
    rb.setTextColor(mTextColor);
    rb.setTextSize(mTextSize);
    rb.setText(mQuestionsArray[pos]);
    rb.setOnClickListener(onQuestionItemListener);
    rb.setSupportButtonTintList(csl);

    mQuestionRBtnsList.add(rb);
}
 
Example 3
Source File: SettingFragment.java    From ClassSchedule with Apache License 2.0 4 votes vote down vote up
private void showThemeDialog() {
    ScrollView scrollView = new ScrollView(getActivity());
    RadioGroup radioGroup = new RadioGroup(getActivity());
    scrollView.addView(radioGroup);
    int margin = ScreenUtils.dp2px(16);
    radioGroup.setPadding(margin / 2, margin, margin, margin);

    for (int i = 0; i < themeColorArray.length; i++) {
        AppCompatRadioButton arb = new AppCompatRadioButton(getActivity());

        RadioGroup.LayoutParams params =
                new RadioGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT);

        arb.setLayoutParams(params);
        arb.setId(i);
        arb.setTextColor(getResources().getColor(themeColorArray[i]));
        arb.setText(themeNameArray[i]);
        arb.setTextSize(16);
        arb.setPadding(0, margin / 2, 0, margin / 2);
        radioGroup.addView(arb);
    }

    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(RadioGroup group, int checkedId) {
            theme = checkedId;
        }
    });

    DialogHelper dialogHelper = new DialogHelper();
    dialogHelper.showCustomDialog(getActivity(), scrollView,
            getString(R.string.theme_preference), new DialogListener() {
                @Override
                public void onPositive(DialogInterface dialog, int which) {
                    super.onPositive(dialog, which);
                    dialog.dismiss();
                    String key = getString(R.string.app_preference_theme);
                    int oldTheme = Preferences.getInt(key, 0);

                    if (theme != oldTheme) {
                        Preferences.putInt(key, theme);
                        ActivityUtil.finishAll();
                        startActivity(new Intent(app.mContext, CourseActivity.class));
                    }
                }
            });
}