本文整理汇总了Java中com.rey.material.widget.CheckBox类的典型用法代码示例。如果您正苦于以下问题:Java CheckBox类的具体用法?Java CheckBox怎么用?Java CheckBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CheckBox类属于com.rey.material.widget包,在下文中一共展示了CheckBox类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findView
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
private void findView() {
context = CreateGroupActivity.this;
head = (SelectableRoundedImageView)findViewById(R.id.head);
groupname_et = (EditText)findViewById(R.id.groupname_et);
visible_cb = (CheckBox)findViewById(R.id.visible_cb);
head.setOnClickListener(this);
findViewById(R.id.head_tv).setOnClickListener(this);
param.setVisble("1");
visible_cb.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b){
param.setVisble("1");
}else{
param.setVisble("0");
}
}
});
}
示例2: getView
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
CompoundButton v = (CompoundButton)convertView;
if(v == null) {
v = (mMode == MODE_MULTI_ITEMS) ? new CheckBox(parent.getContext(), null, 0, mCheckBoxStyle) : new RadioButton(parent.getContext(), null, 0, mRadioButtonStyle);
if(mItemHeight != ViewGroup.LayoutParams.WRAP_CONTENT)
v.setMinHeight(mItemHeight);
v.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
v.setTextDirection(((InternalListView)parent).isLayoutRtl() ? View.TEXT_DIRECTION_RTL : View.TEXT_DIRECTION_LTR);
v.setTextAppearance(v.getContext(), mItemTextAppearance);
ViewCompat.setPaddingRelative(v, mContentPadding, 0, 0, 0);
}
v.setTag(position);
v.setText(mItems[position]);
if(v instanceof CheckBox)
((CheckBox) v).setCheckedImmediately(mSelected[position]);
else
((RadioButton) v).setCheckedImmediately(mSelected[position]);
v.setOnCheckedChangeListener(this);
return v;
}
示例3: onBindView
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
@Override
protected void onBindView(View view) {
super.onBindView(view);
CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkable);
checkBox.setCheckedImmediately(isChecked());
syncSummaryView();
}
示例4: setCheckBoex
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
public void setCheckBoex(CheckBox checkBoex) {
this.mCheckBoex = checkBoex;
}
示例5: initCheckBox
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
private CheckBox initCheckBox() {
if (null == this.mCheckBoex) {
CheckBox checkBox = new CheckBox(mContext);
checkBox.setLayoutParams(layoutParams);
checkBox.applyStyle(R.style.RedCheckBox);
checkBox.setId(R.id.item_checkbox);
checkBox.setChecked(false);
return checkBox;
} else {
return this.mCheckBoex;
}
}
示例6: findView
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
private void findView() {
register_et = (EditTextWithDelete) findViewById(R.id.register_et);
next_btn = (Button) findViewById(R.id.next_btn);
agree_cb = (CheckBox) findViewById(R.id.agree_cb);
agree_cb.setChecked(true);
next_btn.setOnClickListener(this);
}
示例7: addGroupCheckBoxesToLayout
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
public static void addGroupCheckBoxesToLayout(GroupCollection groupCollection, FlowLayout layout,
Set<String> listOfGroupsPreChecked, final Set<String> checked_groups,
final CompoundButton.OnCheckedChangeListener checkedChangeListener) {
LayoutInflater l = LayoutInflater.from(layout.getContext());
for (final Group group : groupCollection.getItems().values()) {
boolean isContained = listOfGroupsPreChecked.contains(group.getUid());
if (isContained)
checked_groups.add(group.getUid());
CheckBox p = (CheckBox) l.inflate(R.layout.executable_group, layout, false);
p.setChecked(isContained);
// The first entry of weekDays_Strings is an empty string
p.setText(group.name);
p.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
if (b)
checked_groups.add(group.getUid());
else
checked_groups.remove(group.getUid());
if (checkedChangeListener != null)
checkedChangeListener.onCheckedChanged(compoundButton, b);
}
});
layout.addView(p);
}
}
示例8: getView
import com.rey.material.widget.CheckBox; //导入依赖的package包/类
@Override
public View getView(int i, View convertView, ViewGroup viewGroup) {
ViewHolder holder;
if (convertView == null) {
convertView = getChildView(i, convertView, viewGroup);
ViewGroup checkBoxLayout = (RelativeLayout) convertView.findViewById(getCheckBoxLayout());
addCheckBox(checkBoxLayout);
holder = new ViewHolder();
holder.checkBox = (CheckBox) checkBoxLayout.findViewById(R.id.item_checkbox);
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
Integer index = (Integer) compoundButton.getTag(R.id.checkbox_status);
if (b) {
if (checkedItemList.indexOf(index) == -1) {
checkedItemList.add(index);
}
} else {
checkedItemList.remove(index);
}
if (null != checkBoexListener) {
checkBoexListener.OnCheckBoexListener(compoundButton, index);
}
}
});
convertView.setTag(R.id.item_checkbox, holder);
} else {
convertView = getChildView(i, convertView, viewGroup);
holder = (ViewHolder) convertView.getTag(R.id.item_checkbox);
}
holder.checkBox.setTag(R.id.checkbox_status, i);
if (checkedItemList.contains(i)) {
holder.checkBox.setChecked(true);
} else {
holder.checkBox.setChecked(false);
}
switch (getCurrentState()) {
case STATE_EDIT:
checkedItemList = new ArrayList<Integer>();
holder.checkBox.setVisibility(View.GONE);
break;
case STATE_COMPLETE:
checkedItemList = new ArrayList<Integer>();
holder.checkBox.setVisibility(View.VISIBLE);
break;
case STATE_REMOVE:
holder.checkBox.setVisibility(View.VISIBLE);
break;
}
return convertView;
}