本文整理了Java中com.google.gwt.user.client.ui.CheckBox.setChecked()
方法的一些代码示例,展示了CheckBox.setChecked()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CheckBox.setChecked()
方法的具体详情如下:
包路径:com.google.gwt.user.client.ui.CheckBox
类名称:CheckBox
方法名:setChecked
[英]Checks or unchecks this check box. Does not fire ValueChangeEvent. (If you want the event to fire, use #setValue(Boolean,boolean))
[中]选中或取消选中此复选框。不触发ValueChangeEvent。(如果希望触发事件,请使用#setValue(布尔值,布尔值))
代码示例来源:origin: stackoverflow.com
@Override
public View getView(int position, View convertView, ViewGroup parent){
CheckBox favoriteBox =(CheckBox)result.findViewById(R.id.favorite_checkbox);
favoriteBox.setChecked(true);
favoriteBox.setEnabled(false);
代码示例来源:origin: stackoverflow.com
CheckBox cbx = (CheckBox)findViewById(R.id.cbx_china);
cbx.setChecked(textToSearch == cbx.getText());
cbx = (CheckBox)findViewById(R.id.cbx_canada);
cbx.setChecked(textToSearch == cbx.getText());
代码示例来源:origin: stackoverflow.com
CheckBox checkBox = (CheckBox)getActivity().findViewById(R.id.my_checkbox);
checkBox.setChecked(true); //Check the check box
checkBox.setEnabled(false); //Disable the check box
代码示例来源:origin: stackoverflow.com
<CheckBox
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sample text"/>
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.cell_view, parent, false);
CheckBox checkBox = (CheckBox) rowView.findViewById(R.id.checkbox);
checkBox.setText("MY TEXT GOES HERE");// Update Your text
checkBox.setChecked(true);// Set checked/unchecked based on your functionality.
return rowView;
}
代码示例来源:origin: stackoverflow.com
public void bindView(View view, Context context, Cursor cursor) {
CheckBox checkbox = (CheckBox)view.findViewById(R.id.completed);
TextView due_date = (TextView)view.findViewById(R.id.due_date);
String title = cursor.getString(cursor.getColumnIndex(Tasks.TITLE));
boolean completed = Util.intToBool(cursor.getInt(cursor.getColumnIndex(Tasks.COMPLETED)));
SimpleDateFormat format = new SimpleDateFormat("EEEEEE, MMM dd yyyy hh:mm aa");
long unixTime = cursor.getLong(cursor.getColumnIndex(Tasks.DUE_DATE));
Calendar due = Util.timestampToDate(unixTime);
due_date.setText(format.format(due.getTime()));
checkbox.setText(title);
checkbox.setChecked(completed);
// edit here ..
checkbox.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView,boolean isChecked) {
// update your value in the db
});
代码示例来源:origin: stackoverflow.com
@Override
public boolean setViewValue(View view, Object arg1, String arg2) {
if (view.getId() == R.id.isDelete) {
CheckBox cb = (CheckBox) view;
cb.setText(arg2);
String data = (String) arg1;
if (toBlacklistNumbers.contains(data)) {
cb.setChecked(true);
} else {
cb.setChecked(false);
}
cb.setOnCheckedChangeListener(mListener);
return true;
} else {
return false;
}
}
代码示例来源:origin: stackoverflow.com
private void markAllTags()//this will put a check mark on the ones that are already a tag of that question
{
String tags[] = mUserDb.fetchTagById(mQid);//These are the tags that are already associated with this question
for(int i = 0; i < this.getListAdapter().getCount(); i++)
{
View v = mListView.getChildAt(i);
//View v = this.getListAdapter().getView(i, null, null);
//Log.w("NME", "I = " + this.getListAdapter().getView(i, null, null).findViewById(R.id.checkBox1));
Log.w("NME", "checking to see if V != null");
if(v != null)
{
Log.w("NME", "V != null");
CheckBox cb = (CheckBox)v.findViewById(R.id.checkBox1);
String cbTags = "" + cb.getText();
for(int j = 0; j < tags.length; j++)
{
//Log.w("NME", "cbTag = " + cbTags + " tags[j] = " + tags[j]);
if(cbTags.equals(tags[j]))
{
cb.setChecked(true);
}
}//end for
}//end if null
}//end for
}//end
代码示例来源:origin: stackoverflow.com
CheckBox cb=(CheckBox)findViewById(R.id.checkbox1);
TextView tv=(TextView)findViewById(R.id.textview1);
cb.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(cb.isChecked()){
cb.setChecked(true);
tv.setText(cb.getText().toString());
}
}
});
代码示例来源:origin: stackoverflow.com
cbFocusArea.setText(focusArea.getFocusAreaCodeDescription());
if(focusArea.isFocusAreaCodeChecked() == 1) {
cbFocusArea.setChecked(true);
} else {
cbFocusArea.setChecked(false);
代码示例来源:origin: stackoverflow.com
CheckBox cbx = (CheckBox)findViewById(R.id.cbx_china);
if (textToSearch == cbx.getText())
cbx.setChecked(!cbx.isChecked());
代码示例来源:origin: stackoverflow.com
.show();
male.setEnabled(false); // disable checkbox
male.setChecked(true);
代码示例来源:origin: com.blackducksoftware.tools/common-framework
/**
* Builds the remember me check box.
*
* @return the check box
*/
@SuppressWarnings("deprecation")
private CheckBox buildRememberMeCheckBox() {
CheckBox rememberMeCheckBox = new CheckBox("Remember me please!");
rememberMeCheckBox.setStyleName("gwt-Login-RememberMe");
rememberMeCheckBox.setChecked(true);
rememberMeCheckBox.setSize("157px", "20px");
return rememberMeCheckBox;
}
代码示例来源:origin: stackoverflow.com
TableLayout l = (TableLayout) findViewById(ID_OF_YOUR_LAYOUT);
CheckBox box = new CheckBox(this);
box.setChecked(true);
box.setOnCheckedChangeListener(new OnCheckedChangeListener(){
public void onCheckedChanged(CompoundButton arg0, boolean arg1) {
//what happens when the it's unchecked or checked
}
});
l.addView(box);
代码示例来源:origin: stackoverflow.com
CheckBox cb = new CheckBox(mActivity);
cb.setText("Hi");
cb.setButtonDrawable(R.drawable.check_box_selector);
cb.setChecked(true);
cb.setPadding(cb.getPaddingLeft(), padding, padding, padding);
代码示例来源:origin: stackoverflow.com
box.setChecked(false);
代码示例来源:origin: stackoverflow.com
chkPresencia.setChecked(ValorChk==-1);
chkPresencia.setWidth(50);
row.addView(chkPresencia, new TableRow.LayoutParams(4));
chkPrecioPromo.setChecked(ValorChk==-1);
chkPrecioPromo.setWidth(50);
row.addView(chkPrecioPromo, new TableRow.LayoutParams(4));
chkAlerta.setChecked(ValorChk==-1);
chkAlerta.setWidth(50);
row.addView(chkAlerta, new TableRow.LayoutParams(4));
代码示例来源:origin: stackoverflow.com
int i;
for (i = 0; i < 20; i++) {
CheckBox ch = new CheckBox(this);
ch.setTag(Integer.valueOf(i));
ch.setText("CheckBox " + i);
ch.setChecked(false);
ch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked) {
numChecked++;
} else {
numChecked--;
}
if (numChecked == 4) {
buttonView.setChecked(false);
numChecked--;
// fourth one selected, show your dialog
}
}
});
}
代码示例来源:origin: stackoverflow.com
int i;
int count = 0;
for (i = 0; i < 10; i++) {
CheckBox cb = new CheckBox(this);
cb.setTag(Integer.valueOf(i));
cb.setText("CheckBox " + i);
cb.setChecked(false);
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Log.e("isChecked",""+isChecked);
if (isChecked) {
count++;
} else {
count--;
}
if (count > 1) {
buttonView.setChecked(false);
count--;
}
}
});
}
代码示例来源:origin: stackoverflow.com
cb.setTextColor(Color.BLACK);
if (listitems.get(n).get("state").toString().equals("true")) {
cb.setChecked(true);
my_checked_layout.addView(cb);
cb.setBackgroundColor(Color.argb(200, 8, 242, 2));
checkstate = true;
} else {
cb.setChecked(false);
cb.setBackgroundColor(Color.argb(100, 5, 214, 0));
cb.setTextColor(Color.parseColor("#F7F7F7"));
代码示例来源:origin: stackoverflow.com
final CheckBox other=holder.inversion;
convertView.setTag(holder);
holder.inversion.setEnabled(false);
// set checkchanged listener to your first checkbox
holder.key.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
//enable if the first checkbox is checked/ticked
other.setEnabled(true);
}
}
});
holder.key.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
CheckBox cb = (CheckBox) v;
DiatonicMajorKey _key = (DiatonicMajorKey) cb.getTag();
_key.setKeySelected(cb.isChecked());
// handle of inversion checkbox to enable/disable it
other.setEnabled(cb.isChecked());
other.setChecked(false);
}
});
内容来源于网络,如有侵权,请联系作者删除!