本文整理汇总了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();
}
});
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
});
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}
示例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));
}
示例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;
}