本文整理了Java中android.widget.CheckBox.toggle()
方法的一些代码示例,展示了CheckBox.toggle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CheckBox.toggle()
方法的具体详情如下:
包路径:android.widget.CheckBox
类名称:CheckBox
方法名:toggle
暂无
代码示例来源:origin: ankidroid/Anki-Android
@Override
public boolean onItemLongClick(AdapterView<?> adapterView, View view, final int position, long id) {
mLastSelectedPosition = position;
loadMultiSelectMode();
// click on whole cell triggers select
CheckBox cb = (CheckBox) view.findViewById(R.id.card_checkbox);
cb.toggle();
onCheck(position, view);
recenterListView(view);
mCardsAdapter.notifyDataSetChanged();
return true;
}
});
代码示例来源:origin: ankidroid/Anki-Android
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (mInMultiSelectMode) {
// click on whole cell triggers select
CheckBox cb = (CheckBox) view.findViewById(R.id.card_checkbox);
cb.toggle();
onCheck(position, view);
} else {
// load up the card selected on the list
mCurrentCardId = Long.parseLong(getCards().get(position).get("id"));
sCardBrowserCard = getCol().getCard(mCurrentCardId);
// start note editor using the card we just loaded
Intent editCard = new Intent(CardBrowser.this, NoteEditor.class);
editCard.putExtra(NoteEditor.EXTRA_CALLER, NoteEditor.CALLER_CARDBROWSER_EDIT);
editCard.putExtra(NoteEditor.EXTRA_CARD_ID, sCardBrowserCard.getId());
startActivityForResultWithAnimation(editCard, EDIT_CARD, ActivityTransitionAnimation.LEFT);
}
}
});
代码示例来源:origin: robolectric/robolectric
@Test
public void testWorks() throws Exception {
CheckBox checkBox = new CheckBox(ApplicationProvider.getApplicationContext());
assertThat(checkBox.isChecked()).isFalse();
checkBox.setChecked(true);
assertThat(checkBox.isChecked()).isTrue();
checkBox.toggle();
assertThat(checkBox.isChecked()).isFalse();
checkBox.performClick(); // Used to support performClick(), but Android doesn't. Sigh.
// assertThat(checkBox.isChecked()).isFalse();
}
}
代码示例来源:origin: stackoverflow.com
chk1.toggle();
chk2.toggle();
代码示例来源:origin: fossasia/pslab-android
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == RECORD_AUDIO_REQUEST_CODE) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
((OscilloscopeActivity) getActivity()).isInBuiltMicSelected = true;
} else {
Toast.makeText(getActivity(), "This feature won't work.", Toast.LENGTH_SHORT).show();
if (checkBoxMIC.isChecked())
checkBoxMIC.toggle();
}
}
}
代码示例来源:origin: wallabag/android-app
@Override
public void onClick(View v) {
checkboxTTSAutoplayNext.toggle();
}
});
代码示例来源:origin: klinker24/Android-Blur-Launcher
@Override
public void toggle() {
mCheckBox.toggle();
}
}
代码示例来源:origin: jasonwyatt/Squeaky-Android
@Override
public void onClick(View view) {
if (view == itemView) {
mCheckbox.toggle();
}
}
代码示例来源:origin: BaaSBeginner/leanchat-android
@Override
public void onClick(View v) {
checkBox.toggle();
}
});
代码示例来源:origin: posm/OpenMapKitAndroid
@Override
public void onClick(View v) {
checkBox.toggle();
}
}
代码示例来源:origin: ywwynm/EverythingDone
@Override
public void onClick(View v) {
mCbQuickCreate.toggle();
}
});
代码示例来源:origin: huangfangyi/FanXin
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
checkBox.toggle();
}
});
代码示例来源:origin: stackoverflow.com
private void onClickSetAllAttendance() {
selectAll.setOnClickListener( new OnClickListener() {
@Override
public void onClick( View v ) {
CheckBox box = (CheckBox) v;
box.toggle();
if( box.isChecked() )
listAdapter.selectAll();
else
listAdapter.deselectAll();
}
});
}
代码示例来源:origin: thealeksandr/PFLockScreen-Android
public int input(String number) {
if (mCode.length() == mCodeLength) {
return mCode.length();
}
mCodeViews.get(mCode.length()).toggle(); //.setChecked(true);
mCode += number;
if (mCode.length() == mCodeLength && mListener != null) {
mListener.onCodeCompleted(mCode);
}
return mCode.length();
}
代码示例来源:origin: thealeksandr/PFLockScreen-Android
public int delete() {
if (mListener != null) {
mListener.onCodeNotCompleted(mCode);
}
if (mCode.length() == 0) {
return mCode.length();
}
mCode = mCode.substring(0, mCode.length() - 1);
mCodeViews.get(mCode.length()).toggle(); //.setChecked(false);
return mCode.length();
}
代码示例来源:origin: doc-rj/smartcard-reader
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
CheckBox checkBox = (CheckBox) v.findViewById(R.id.check_box);
checkBox.toggle();
GroupItem grp = mGrpAdapter.getGroup(groupPosition);
grp.memberCount += checkBox.isChecked() ? 1 : -1;
grp.member[childPosition] = checkBox.isChecked();
mGrpAdapter.notifyDataSetChanged();
return true;
}
});
代码示例来源:origin: huangfangyi/YiChat
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
checkBox.toggle();
ForwardGroupAdapter.getIsSelected().put(position, checkBox.isChecked());//将CheckBox的选中状况记录下来
// 调整选定条目
if (checkBox.isChecked() == true) {
checkGroupList.add(adAdapter.getItem(position));
} else {
checkGroupList.remove(adAdapter.getItem(position));
}
}
代码示例来源:origin: huangfangyi/YiChat
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
checkBox.toggle();
ForwardSingleAdapter.getIsSelected().put(position, checkBox.isChecked());//将CheckBox的选中状况记录下来
// 调整选定条目
if (checkBox.isChecked() == true) {
users.add(adAdapter.getItem(position));
} else {
users.remove(adAdapter.getItem(position));
}
}
代码示例来源:origin: YiChat/android_YiChat_Lite
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkbox);
checkBox.toggle();
ChooseContactAdapter.getIsSelected().put(position, checkBox.isChecked());//将CheckBox的选中状况记录下来
// 调整选定条目
if (checkBox.isChecked() == true) {
users.add(adAdapter.getItem(position));
} else {
users.remove(adAdapter.getItem(position));
}
}
代码示例来源:origin: SachinVin/citra_android
@Override
public void onClick(View clicked)
{
mCheckbox.toggle();
getAdapter().onBooleanClick(mItem, getAdapterPosition(), mCheckbox.isChecked());
}
}
内容来源于网络,如有侵权,请联系作者删除!