本文整理了Java中android.widget.CheckBox.setChecked()
方法的一些代码示例,展示了CheckBox.setChecked()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CheckBox.setChecked()
方法的具体详情如下:
包路径:android.widget.CheckBox
类名称:CheckBox
方法名:setChecked
暂无
代码示例来源: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: TeamNewPipe/NewPipe
private void setupSkipSilenceControl(@NonNull View rootView) {
skipSilenceCheckbox = rootView.findViewById(R.id.skipSilenceCheckbox);
if (skipSilenceCheckbox != null) {
skipSilenceCheckbox.setChecked(initialSkipSilence);
skipSilenceCheckbox.setOnCheckedChangeListener((compoundButton, isChecked) ->
setCurrentPlaybackParameters());
}
}
代码示例来源:origin: seven332/EhViewer
private void setExcludedTagNamespaces(View view, int value) {
for (int i = 0; i < EXCLUDED_TAG_GROUP_RES_ID.length; i++) {
CheckBox cb = (CheckBox) view.findViewById(EXCLUDED_TAG_GROUP_RES_ID[i]);
cb.setChecked(NumberUtils.int2boolean(value & EXCLUDED_TAG_GROUP_ID[i]));
}
}
代码示例来源:origin: seven332/EhViewer
@SuppressLint("InflateParams")
public CheckBoxDialogBuilder(Context context, String message, String checkText, boolean checked) {
super(context);
View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_checkbox_builder, null);
setView(view);
TextView messageView = (TextView) view.findViewById(R.id.message);
mCheckBox = (CheckBox) view.findViewById(R.id.checkbox);
messageView.setText(message);
mCheckBox.setText(checkText);
mCheckBox.setChecked(checked);
}
代码示例来源:origin: stackoverflow.com
TextView tvListText = (TextView)view.findViewById(R.id.list_text);
CheckBox cbListCheck = (CheckBox)view.findViewById(R.id.list_checkbox);
cbListCheck.setChecked((cur.getInt(cur.getColumnIndex(Datenbank.DB_STATE))==0? false:true))));
代码示例来源:origin: TeamNewPipe/NewPipe
private void setupHookingControl(@NonNull View rootView) {
unhookingCheckbox = rootView.findViewById(R.id.unhookCheckbox);
if (unhookingCheckbox != null) {
unhookingCheckbox.setChecked(pitch != tempo);
unhookingCheckbox.setOnCheckedChangeListener((compoundButton, isChecked) -> {
if (isChecked) return;
// When unchecked, slide back to the minimum of current tempo or pitch
final double minimum = Math.min(getCurrentPitch(), getCurrentTempo());
setSliders(minimum);
setCurrentPlaybackParameters();
});
}
}
代码示例来源:origin: stackoverflow.com
final CheckBox cBox = (CheckBox) inView.findViewById(R.id.bcheck); // your
CheckBox cb = (CheckBox) v.findViewById(R.id.your_checkbox_id);
cBox.setChecked(itemChecked.get(pos)); // this will Check or Uncheck the
代码示例来源:origin: ankidroid/Anki-Android
/**
* Build the custom view used by the dialog
*/
private View buildCustomView(Bundle savedInstanceState) {
SharedPreferences preferences = AnkiDroidApp.getSharedPrefs(this);
LayoutInflater inflater = getLayoutInflater();
@SuppressLint("InflateParams") // when you inflate into an alert dialog, you have no parent view
View rootView = inflater.inflate(R.layout.feedback, null);
mAlwaysReportCheckBox = rootView.findViewById(R.id.alwaysReportCheckbox);
mAlwaysReportCheckBox.setChecked(preferences.getBoolean("autoreportCheckboxValue", true));
mUserComment = rootView.findViewById(R.id.etFeedbackText);
// Set user comment if reloading after the activity has been stopped
if (savedInstanceState != null) {
String savedValue = savedInstanceState.getString(STATE_COMMENT);
if (savedValue != null) {
mUserComment.setText(savedValue);
}
}
return rootView;
}
代码示例来源:origin: CarGuo/GSYVideoPlayer
View view = inflater.inflate(R.layout.layout_custom_dialog, null);
setContentView(view);
txtTitle = (TextView) view.findViewById(R.id.dialog_input_title);
editMessage = (EditText) view.findViewById(R.id.dialog_input_dialog_edit);
btnPostive = (TextView) view.findViewById(R.id.dialog_input_dialog_postive);
btnNegative = (TextView) view.findViewById(R.id.dialog_input_dialog_negative);
cacheCheck = (CheckBox) view.findViewById(R.id.dialog_input_check);
cacheCheck.setChecked(cache);
代码示例来源:origin: ankidroid/Anki-Android
v.setBackgroundColor(backgroundColor);
final CheckBox checkBox = (CheckBox) v.findViewById(R.id.card_checkbox);
checkBox.setChecked(true);
} else {
checkBox.setChecked(false);
checkBox.setChecked(false);
checkBox.setVisibility(View.GONE);
代码示例来源:origin: stackoverflow.com
holder = new ViewHolder();
convertView = mInflater.inflate(R.layout.custom_gallery_item, null);
holder.imgThumb = (ImageView) convertView.findViewById(R.id.imgThumb);
holder.chkImage = (CheckBox) convertView.findViewById(R.id.chkImage);
int id = cb.getId();
if (thumbnailsselection[id]) {
cb.setChecked(false);
thumbnailsselection[id] = false;
} else {
cb.setChecked(true);
thumbnailsselection[id] = true;
代码示例来源:origin: k9mail/k-9
TextView intro = layout.findViewById(R.id.password_prompt_intro);
String serverPasswords = activity.getResources().getQuantityString(
R.plurals.settings_import_server_passwords,
TextView incomingText = layout.findViewById(R.id.password_prompt_incoming_server);
incomingText.setText(activity.getString(R.string.settings_import_incoming_server,
incoming.host));
mIncomingPasswordView = layout.findViewById(R.id.incoming_server_password);
mIncomingPasswordView.addTextChangedListener(this);
} else {
mUseIncomingView.setChecked(true);
mUseIncomingView.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
mUseIncomingView.setChecked(false);
mUseIncomingView.setVisibility(View.GONE);
mOutgoingPasswordView.setEnabled(true);
mUseIncomingView.setChecked(mUseIncoming);
代码示例来源:origin: facebook/facebook-android-sdk
ProfilePictureView profilePic = (ProfilePictureView) convertView.findViewById(
R.id.slotPic);
if (userId != null) {
TextView userNameTextView = (TextView) convertView.findViewById(
R.id.slotUserName);
userNameTextView.setText(userName);
final CheckBox currentUserCheckBox = (CheckBox) convertView.findViewById(
R.id.currentUserIndicator);
currentUserCheckBox.setChecked(
slotManager.getSelectedSlot() == slot
&& slot.getUserInfo() != null);
代码示例来源: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: stackoverflow.com
ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_multiple_choice,
R.id.text1, Cheeses.sCheeseStrings) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
CheckBox checkBox = (CheckBox) v.findViewById(R.id.CheckBox);
checkBox.setChecked(((ListView)parent).isItemChecked(position));
return v;
}
};
代码示例来源:origin: stackoverflow.com
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.inflator, parent, false);
final CheckBox checks = (CheckBox) itemView.findViewById(R.id.b);
final TextView _setappname = (TextView) itemView.findViewById(R.id.a);
checks.setChecked(data.get(position).isSelected());
代码示例来源:origin: stackoverflow.com
null);
TextView name = (TextView) vi
.findViewById(R.id.restaurant_multi_select_title);
ImageView image = (ImageView) vi
.findViewById(R.id.restaurant_multi_select_list_item_image);
CheckBox cb = (CheckBox) vi
.findViewById(R.id.restaurant_multi_select_checkBox);
cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
cb.setChecked(status.get(position));
HashMap<String, String> restaurant = data.get(position);
name.setText(restaurant.get("name"));
代码示例来源:origin: stackoverflow.com
TextView label = (TextView) row.findViewById(R.id.weekofday);
label.setText(month[position]);
CheckBox checkBox = (CheckBox) row.findViewById(R.id.checkBox);
checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
checkBox.setChecked(status.get(position));
return row;
代码示例来源:origin: stackoverflow.com
if(convertView==null)
vi = mInflater.inflate(R.layout.row, null);
TextView tv= (TextView) vi.findViewById(R.id.textView1);
tv1= (TextView) vi.findViewById(R.id.textView2);
cb = (CheckBox) vi.findViewById(R.id.checkBox1);
tv.setText("Name :"+ name1.get(position));
tv1.setText("Phone No :"+ phno1.get(position));
cb.setTag(position);
cb.setChecked(mCheckStates.get(position, false));
cb.setOnCheckedChangeListener(this);
代码示例来源:origin: chrisk44/Hijacker
stopCmdView.setText(action.getStopCmd());
if(action.getType()==TYPE_AP){
((RadioButton)fragmentView.findViewById(R.id.ap_rb)).setChecked(true);
fragmentView.findViewById(R.id.st_rb).setEnabled(false);
requirement_cb.setChecked(action.requiresClients());
}else{
((RadioButton) fragmentView.findViewById(R.id.st_rb)).setChecked(true);
fragmentView.findViewById(R.id.ap_rb).setEnabled(false);
requirement_cb.setChecked(action.requiresConnected());
requirement_cb.setText(R.string.requires_associated);
has_process_name_cb.setChecked(true);
processNameView.setText(action.getProcessName());
内容来源于网络,如有侵权,请联系作者删除!