本文整理了Java中android.widget.CheckBox.isChecked()
方法的一些代码示例,展示了CheckBox.isChecked()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CheckBox.isChecked()
方法的具体详情如下:
包路径:android.widget.CheckBox
类名称:CheckBox
方法名:isChecked
暂无
代码示例来源:origin: seven332/EhViewer
private int getExcludedTagNamespaces(View view) {
int newValue = 0;
for (int i = 0; i < EXCLUDED_TAG_GROUP_RES_ID.length; i++) {
CheckBox cb = (CheckBox) view.findViewById(EXCLUDED_TAG_GROUP_RES_ID[i]);
if (cb.isChecked()) {
newValue |= EXCLUDED_TAG_GROUP_ID[i];
}
}
return newValue;
}
}
代码示例来源:origin: stackoverflow.com
protected void onListItemClick(ListView l, View v, int position, long id) {
Toast.makeText(getApplicationContext(), "You have selected item no."
+(position+1)+"", Toast.LENGTH_SHORT).show();
super.onListItemClick(l, v, position, id);
if (v != null) {
CheckBox checkBox = (CheckBox)v.findViewById(R.id.Checkbox);
checkBox.setChecked(!checkBox.isChecked());
}
}
代码示例来源:origin: ankidroid/Anki-Android
private void onCheck(int position, View cell) {
CheckBox checkBox = (CheckBox) cell.findViewById(R.id.card_checkbox);
if (checkBox.isChecked()) {
mCheckedCardPositions.add(position);
} else {
mCheckedCardPositions.remove(position);
}
updateMultiselectMenu();
if (mCheckedCardPositions.isEmpty()) {
// when 0 are selected: end selection mode
endMultiSelectMode();
} else {
mActionBarTitle.setText(Integer.toString(mCheckedCardPositions.size()));
}
}
代码示例来源:origin: stackoverflow.com
final CheckBox cBox = (CheckBox) inView.findViewById(R.id.bcheck); // your
CheckBox cb = (CheckBox) v.findViewById(R.id.your_checkbox_id);
if (cb.isChecked()) {
itemChecked.set(pos, true);
} else if (!cb.isChecked()) {
itemChecked.set(pos, false);
代码示例来源:origin: stackoverflow.com
String skipMessage = settings.getString("skipMessage", "NOT checked");
dontShowAgain = (CheckBox) eulaLayout.findViewById(R.id.skip);
adb.setView(eulaLayout);
adb.setTitle("Attention");
String checkBoxResult = "NOT checked";
if (dontShowAgain.isChecked()) {
checkBoxResult = "checked";
String checkBoxResult = "NOT checked";
if (dontShowAgain.isChecked()) {
checkBoxResult = "checked";
代码示例来源:origin: robolectric/robolectric
@Test
public void testCheckBoxCheckedIsSet() throws Exception {
View mediaView = inflate(layout.main);
assertThat(((CheckBox) mediaView.findViewById(R.id.true_checkbox)).isChecked()).isTrue();
assertThat(((CheckBox) mediaView.findViewById(R.id.false_checkbox)).isChecked()).isFalse();
assertThat(((CheckBox) mediaView.findViewById(R.id.default_checkbox)).isChecked()).isFalse();
}
代码示例来源:origin: wdullaer/MaterialDateTimePicker
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
mode24Hours.isChecked()
).show();
});
now.get(Calendar.HOUR_OF_DAY),
now.get(Calendar.MINUTE),
mode24Hours.isChecked()
);
} else {
now.get(Calendar.MINUTE),
now.get(Calendar.SECOND),
mode24Hours.isChecked()
);
tpd.setThemeDark(modeDarkTime.isChecked());
tpd.vibrate(vibrateTime.isChecked());
tpd.dismissOnPause(dismissTime.isChecked());
tpd.enableSeconds(enableSeconds.isChecked());
tpd.setVersion(showVersion2.isChecked() ? TimePickerDialog.Version.VERSION_2 : TimePickerDialog.Version.VERSION_1);
if (modeCustomAccentTime.isChecked()) {
tpd.setAccentColor(Color.parseColor("#9C27B0"));
if (titleTime.isChecked()) {
tpd.setTitle("TimePicker Title");
if (limitSelectableTimes.isChecked()) {
代码示例来源:origin: wdullaer/MaterialDateTimePicker
);
dpd.setThemeDark(modeDarkDate.isChecked());
dpd.vibrate(vibrateDate.isChecked());
dpd.dismissOnPause(dismissDate.isChecked());
dpd.showYearPickerFirst(showYearFirst.isChecked());
dpd.setVersion(showVersion2.isChecked() ? DatePickerDialog.Version.VERSION_2 : DatePickerDialog.Version.VERSION_1);
if (modeCustomAccentDate.isChecked()) {
dpd.setAccentColor(Color.parseColor("#9C27B0"));
if (titleDate.isChecked()) {
dpd.setTitle("DatePicker Title");
if (highlightDays.isChecked()) {
Calendar date1 = Calendar.getInstance();
Calendar date2 = Calendar.getInstance();
dpd.setHighlightedDays(days);
if (limitSelectableDays.isChecked()) {
Calendar[] days = new Calendar[13];
for (int i = -6; i < 7; i++) {
if (switchOrientation.isChecked()) {
if (dpd.getVersion() == DatePickerDialog.Version.VERSION_1) {
dpd.setScrollOrientation(DatePickerDialog.ScrollOrientation.HORIZONTAL);
代码示例来源:origin: stackoverflow.com
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
//Get related checkbox and change flag status..
CheckBox cb = (CheckBox)v.findViewById(R.id.rowDone);
cb.setChecked(!cb.isChecked());
Toast.makeText(getActivity(), "Click item", Toast.LENGTH_SHORT).show();
}
代码示例来源:origin: westnordost/StreetComplete
@UiThread private void requestOAuthorized()
{
if(dontShowRequestAuthorizationAgain) return;
View inner = LayoutInflater.from(this).inflate(
R.layout.dialog_authorize_now, null, false);
final CheckBox checkBox = inner.findViewById(R.id.checkBoxDontShowAgain);
new AlertDialog.Builder(this)
.setView(inner)
.setPositiveButton(android.R.string.ok, (dialog, which) ->
{
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
intent.putExtra(SettingsActivity.EXTRA_LAUNCH_AUTH, true);
startActivity(intent);
})
.setNegativeButton(R.string.later, (dialog, which) ->
{
dontShowRequestAuthorizationAgain = checkBox.isChecked();
}).show();
}
代码示例来源:origin: chrisk44/Hijacker
processNameView.setError(getString(R.string.process_name_newline));
processNameView.requestFocus();
}else if(process_name.equals("") && has_process_name_cb.isChecked()){
processNameView.setError(getString(R.string.process_name_empty));
processNameView.requestFocus();
action.setStopCmd(stop_cmd);
if(action.getType()==TYPE_AP){
action.setRequiresClients(requirement_cb.isChecked());
}else{
action.setRequiresConnected(requirement_cb.isChecked());
}else{
if(((RadioGroup) fragmentView.findViewById(R.id.radio_group)).getCheckedRadioButtonId()==R.id.ap_rb){
action.setRequiresClients(requirement_cb.isChecked());
}else{
action.setRequiresConnected(requirement_cb.isChecked());
代码示例来源:origin: stackoverflow.com
.findViewById(R.id.rowTextView);
checkBox = (CheckBox) convertView.findViewById(R.id.CheckBox01);
CheckBox cb = (CheckBox) v;
Contact contact = (Contact) cb.getTag();
contact.setChecked(cb.isChecked());
代码示例来源:origin: westnordost/StreetComplete
public void findSource(final long questId, final QuestGroup group, @Nullable final Location location,
final Listener listener)
{
if(dontShowAgain || isWithinSurveyDistance(questId, group, location))
{
listener.onFindQuestSourceResult(SURVEY);
}
else
{
View inner = LayoutInflater.from(activity).inflate(
R.layout.quest_source_dialog_layout, null, false);
final CheckBox checkBox = inner.findViewById(R.id.checkBoxDontShowAgain);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(activity);
alertDialogBuilder
.setTitle(R.string.quest_source_dialog_title)
.setView(inner)
.setPositiveButton(R.string.quest_generic_confirmation_yes, (dialog, which) ->
{
++timesShown;
dontShowAgain = checkBox.isChecked();
listener.onFindQuestSourceResult(SURVEY);
})
.setNegativeButton(android.R.string.cancel, null);
checkBox.setVisibility(timesShown < 2 ? View.GONE : View.VISIBLE);
alertDialogBuilder.show();
}
}
代码示例来源:origin: stackoverflow.com
mViewHolder.checkBox = (CheckBox)convertView.findViewById(R.id.checkBox1);
mViewHolder.checkBox.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
CheckBox cb = (CheckBox) v.findViewById(R.id.checkBox1);
if (cb.isChecked()) {
checkBoxArrayList.set(position, true);
} else if (!cb.isChecked()) {
checkBoxArrayList.set(position, false);
}
}
});
代码示例来源:origin: stackoverflow.com
mViewHolder.checkBox = (CheckBox)convertView.findViewById(R.id.checkBox1);
mViewHolder.checkBox.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
CheckBox cb = (CheckBox) v.findViewById(R.id.checkBox1);
if (cb.isChecked()) {
checkBoxArrayList.set(position, true);
} else if (!cb.isChecked()) {
checkBoxArrayList.set(position, false);
}
}
});
代码示例来源:origin: stackoverflow.com
cBox.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
CheckBox cb = (CheckBox) v.findViewById(R.id.textcb);
if (cb.isChecked()) {
itemChecked.set(pos, true);
// do some operations here
} else if (!cb.isChecked()) {
itemChecked.set(pos, false);
// do some operations here
}
}
});
代码示例来源:origin: stackoverflow.com
private void ButtonClick() {
View v;
CheckBox chBox;
for (int i = 0; i < myList.getCount(); i++) {
v = myList.getAdapter().getView(i, null, null);
chBox = (chBox) v.findViewById(R.id.checkBox);//your xml id value for checkBox.
if (chBox.isChecked()) {
doSomething();
}
}
....
}
代码示例来源:origin: stackoverflow.com
final Patient rowItem = (Patient) getItem(position);
holder.txtDesc.setText(rowItem.getName());
holder.txtTitle.setText(rowItem.getAddress());
holder.checkbox.setChecked(rowItem.isSelected());
holder.checkbox.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
CheckBox checkbox = (CheckBox)v.findViewById(R.id.checkbox);
rowItem.setSelected(checkbox.isChecked());
}
});
代码示例来源:origin: stackoverflow.com
for (int i = 0; i < yourCustomAdapter.size(); i++) {
View viewRow = listViewParts.getChildAt(i);
CheckBox chkBox = (CheckBox) viewRow
.findViewById(R.id.checkBox);
yourCustomAdapter.get(i).attachmentCheck = chkBox
.isChecked();
}
代码示例来源:origin: stackoverflow.com
mContactListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long arg3) {
CheckBox chkContact = (CheckBox) view.findViewById(R.id.listrow_contact_chkContact);
if (chkContact.isChecked()) {
...
}
});
内容来源于网络,如有侵权,请联系作者删除!