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


Java AppCompatRadioButton类代码示例

本文整理汇总了Java中android.support.v7.widget.AppCompatRadioButton的典型用法代码示例。如果您正苦于以下问题:Java AppCompatRadioButton类的具体用法?Java AppCompatRadioButton怎么用?Java AppCompatRadioButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: initController

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
private void initController(final View actionView, final TextView actionTv,
                            final AppCompatRadioButton serialRb,
                            final AppCompatRadioButton parallelRb,
                            final CardView deleteActionView, final View deleteActionTv) {
    final QueueController controller = new QueueController();
    this.controller = controller;
    controller.initTasks(this, new DownloadQueueListener() {
        @Override public void queueEnd() {
            actionView.setTag(null);
            actionTv.setText(R.string.start);
            // to cancel
            controller.stop();

            serialRb.setEnabled(true);
            parallelRb.setEnabled(true);

            deleteActionView.setEnabled(true);
            deleteActionView.setCardElevation((Float) deleteActionView.getTag());
            deleteActionTv.setEnabled(true);

            adapter.notifyDataSetChanged();
        }
    });

}
 
开发者ID:lingochamp,项目名称:okdownload,代码行数:26,代码来源:QueueActivity.java

示例2: init

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
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);
    }
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:20,代码来源:SingleChooseDialog.java

示例3: setQuestionsGroupView

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
private void setQuestionsGroupView(){
    LinearLayout.LayoutParams rglp = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    LinearLayout.LayoutParams rblp = new LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    mQuestionsGroup.setLayoutParams(rglp);
    ColorStateList colorStateList = new ColorStateList(
            new int[][]{
                    new int[]{mRadioBtnColor},
                    new int[]{mRadioBtnColor}
            },
            new int[]{mRadioBtnColor, mRadioBtnColor}
    );
    for (int i = 0; i < mQuestionsArray.length; i++) {
        AppCompatRadioButton rb = new AppCompatRadioButton(mContext);

        setQuestionItem(i, rb, rblp, colorStateList);
        mQuestionsGroup.addView(rb);
    }
}
 
开发者ID:pro100svitlo,项目名称:LockPattern,代码行数:22,代码来源:DialogLPV.java

示例4: onCreateView

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this,attrs);
            case "Spinner":
                return new AppCompatSpinner(this,attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this,attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this,attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this,attrs);
        }
    }

    return null;
}
 
开发者ID:slartus,项目名称:4pdaClient-plus,代码行数:26,代码来源:BasePreferencesActivity.java

示例5: addRadioButtons

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
private void addRadioButtons(final List<UiCode> codes) {
    uiHandler.post(new Runnable() {
        public void run() {
            Integer selectedViewId = null;
            for (int i = 0; i < codes.size(); i++) {
                UiCode code = codes.get(i);
                if (! enumerator || isAttributeCode(code)) { //if it's enumerator, show only selected code
                    RadioButton radioButton = new AppCompatRadioButton(context);
                    radioButton.setId(i + 1);
                    radioButton.setText(code.toString());
                    radioGroup.addView(radioButton);
                    codeByViewId.put(radioButton.getId(), code);
                    if (isAttributeCode(code)) {
                        selectedViewId = radioButton.getId();
                        radioButton.setSelected(true);
                    }
                }
            }
            if (selectedViewId != null) {
                radioGroup.check(selectedViewId);
            }
        }
    });
}
 
开发者ID:openforis,项目名称:collect-mobile,代码行数:25,代码来源:RadioCodeAttributeComponent.java

示例6: onCreateView

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    // Provide colorized/tinted widgets on non-Material devices
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
        }
    }

    return null;
}
 
开发者ID:VersoBit,项目名称:WeatherDoge,代码行数:27,代码来源:OptionsActivity.java

示例7: onCreate

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
@Override protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_queue);

    initQueueActivity(findViewById(R.id.actionView), (TextView) findViewById(R.id.actionTv),
            (AppCompatRadioButton) findViewById(R.id.serialRb),
            (AppCompatRadioButton) findViewById(R.id.parallelRb),
            (RecyclerView) findViewById(R.id.recyclerView),
            (CardView) findViewById(R.id.deleteActionView), findViewById(R.id.deleteActionTv));
}
 
开发者ID:lingochamp,项目名称:okdownload,代码行数:11,代码来源:QueueActivity.java

示例8: initQueueActivity

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
private void initQueueActivity(final View actionView, final TextView actionTv,
                               final AppCompatRadioButton serialRb,
                               final AppCompatRadioButton parallelRb,
                               RecyclerView recyclerView,
                               final CardView deleteActionView, final View deleteActionTv) {
    initController(actionView, actionTv, serialRb, parallelRb,
            deleteActionView, deleteActionTv);
    initRecyclerView(recyclerView);
    initAction(actionView, actionTv, serialRb, parallelRb, deleteActionView, deleteActionTv);
}
 
开发者ID:lingochamp,项目名称:okdownload,代码行数:11,代码来源:QueueActivity.java

示例9: getView

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.account_sub_item, null);
    }
    TextView tv = (TextView) convertView.findViewById(R.id.account_sub_item_text);
    tv.setText(showSubItems.get(position).getName());
    AppCompatRadioButton acrb = (AppCompatRadioButton) convertView.findViewById(R.id.aitt_button);

    convertView.findViewById(R.id.account_sub_item).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            selectedSubItemId = showSubItems.get(position).getId();
            Log.i(TAG, "selectedSubItemId:>>>>>>" + selectedSubItemId);
            Log.i(TAG, "seletectedItemPosition:" + seletectedItemPosition);
            subAdapter.notifyDataSetChanged();
            String item = items.get(seletectedItemPosition).getItem() + (getSubItemById(selectedSubItemId) != null ? "," + getSubItemById(selectedSubItemId).getName() : "");
            if (mItemListener != null) {
                mItemListener.onItemSelected(item);
                 }
            cancel();
        }
    });
   // ((TextView) ((LinearLayout) convertView).getChildAt(0)).setText(showSubItems.get(position).getName());
    Log.i(TAG, "selectedSubItemId:" + selectedSubItemId);
    Log.i(TAG, "showSubItems.get(position).getId():" + showSubItems.get(position).getId());
    if (showSubItems.get(position).getId() == selectedSubItemId) {
        acrb.setVisibility(View.VISIBLE);
    } else {
        acrb.setVisibility(View.GONE);
    }
    return convertView;
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:34,代码来源:ItemExpenseDialog.java

示例10: onCreateView

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
    // Allow super to try and create a view first
    final View result = super.onCreateView(name, context, attrs);
    if (result != null) {
        return result;
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
        // If we're running pre-L, we need to 'inject' our tint aware Views in place of the
        // standard framework versions
        switch (name) {
            case "EditText":
                return new AppCompatEditText(this, attrs);
            case "Spinner":
                return new AppCompatSpinner(this, attrs);
            case "CheckBox":
                return new AppCompatCheckBox(this, attrs);
            case "RadioButton":
                return new AppCompatRadioButton(this, attrs);
            case "CheckedTextView":
                return new AppCompatCheckedTextView(this, attrs);
        }
    }

    return null;
}
 
开发者ID:AndroidNewbies,项目名称:Sanxing,代码行数:28,代码来源:SettingsActivity.java

示例11: onResume

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
public void onResume() {
    // reset to default
    AppCompatRadioButton activeRadioButton = this.activeRadioButton;
    clearCheckedChildren();
    this.activeRadioButton = activeRadioButton;
    this.activeRadioButton.setChecked(true);
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:8,代码来源:RadioGroupGridLayout.java

示例12: setChildrenOnClickListener

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
private void setChildrenOnClickListener(AppCompatRadioButton child) {
    GridLayout parent = (GridLayout) child.getParent();
    final int childCount = parent.getChildCount();
    for (int i = 0; i < childCount; i++) {
        final View v = parent.getChildAt(i);
        if (v instanceof AppCompatRadioButton) {
            if (((RadioButton) v).isChecked()) {
                activeRadioButton = (AppCompatRadioButton) v;
            }
            v.setOnClickListener(this);
        }
    }
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:14,代码来源:RadioGroupGridLayout.java

示例13: clearCheckedChildren

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
private void clearCheckedChildren() {
    for (int i = 0; i < getChildCount(); i++) {
        if (getChildAt(i) instanceof AppCompatRadioButton) {
            ((AppCompatRadioButton) getChildAt(i)).setChecked(false);
        }
    }
}
 
开发者ID:willowtreeapps,项目名称:spruce-android,代码行数:8,代码来源:RadioGroupGridLayout.java

示例14: BucketViewHolder

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
BucketViewHolder(ViewGroup parent, View itemView) {
    super(itemView);
    this.mParentView = parent;
    mTvBucketName = (TextView) itemView.findViewById(R.id.tv_bucket_name);
    mIvBucketCover = (SquareImageView) itemView.findViewById(R.id.iv_bucket_cover);
    mRbSelected = (AppCompatRadioButton) itemView.findViewById(R.id.rb_selected);

    itemView.setOnClickListener(this);

    int checkTint = ThemeUtils.resolveColor(itemView.getContext(), R.attr.gallery_checkbox_button_tint_color, R.color.gallery_default_checkbox_button_tint_color);
    CompoundButtonCompat.setButtonTintList(mRbSelected, ColorStateList.valueOf(checkTint));
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:13,代码来源:BucketAdapter.java

示例15: getView

import android.support.v7.widget.AppCompatRadioButton; //导入依赖的package包/类
public View getView(final int position, View convertView, ViewGroup parent) {
    Answer item = (Answer) getItem(position);
    if (convertView == null) {
        radioListItemView = (RadioListItemView)View.inflate(context, R.layout.radio_list_item, null);
    } else{
        radioListItemView = (RadioListItemView)convertView;
    }
    final AppCompatRadioButton radio = (AppCompatRadioButton)radioListItemView.findViewById(R.id.radio);
    radio.setChecked(item.isChecked());
    final TextView textView = (TextView)radioListItemView.findViewById(R.id.tv1);
    final RadioListItemView finalRadioListItemView = radioListItemView;
    textView.setText(item.getAnswer());

    radioListItemView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            setAnswer(position, finalRadioListItemView);
        }
    });
    radio.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            setAnswer(position, finalRadioListItemView);
        }
    });

    return radioListItemView;
}
 
开发者ID:alfredayibonte,项目名称:QuestionnaireView,代码行数:29,代码来源:RadioListAdapter.java


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