android.widget.CheckBox.setText()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(269)

本文整理了Java中android.widget.CheckBox.setText()方法的一些代码示例,展示了CheckBox.setText()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CheckBox.setText()方法的具体详情如下:
包路径:android.widget.CheckBox
类名称:CheckBox
方法名:setText

CheckBox.setText介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

public void onCheckedChanged(CompoundButton buttonView,
                boolean isChecked) {
  if (isChecked) {
   cb.setText(R.string.checked);
  }
  else {
   cb.setText(R.string.unchecked);
  }
 }
}

代码示例来源:origin: googlemaps/android-maps-utils

/**
 * Creates check box for a given search term
 *
 * @param keyword the search terms associated with the check box
 */
private void makeCheckBox(final String keyword) {
  mCheckboxLayout.setVisibility(View.VISIBLE);
  // Make new checkbox
  CheckBox checkBox = new CheckBox(this);
  checkBox.setText(keyword);
  checkBox.setTextColor(HEATMAP_COLORS[mOverlaysRendered]);
  checkBox.setChecked(true);
  checkBox.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
      CheckBox c = (CheckBox) view;
      // Text is the keyword
      TileOverlay overlay = mOverlays.get(keyword);
      if (overlay != null) {
        overlay.setVisible(c.isChecked());
      }
    }
  });
  mCheckboxLayout.addView(checkBox);
}

代码示例来源: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: seven332/EhViewer

@SuppressLint("InflateParams")
public ListCheckBoxDialogBuilder(Context context, CharSequence[] items,
    final OnItemClickListener listener, String checkText, boolean checked) {
  super(context);
  View view = LayoutInflater.from(getContext()).inflate(R.layout.dialog_list_checkbox_builder, null);
  setView(view);
  ListView listView = (ListView) ViewUtils.$$(view, R.id.list_view);
  mCheckBox = (CheckBox) ViewUtils.$$(view, R.id.checkbox);
  listView.setAdapter(new ArrayAdapter<>(getContext(), R.layout.item_select_dialog, items));
  listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
      if (listener != null) {
        listener.onItemClick(ListCheckBoxDialogBuilder.this, mDialog, position);
      }
      mDialog.dismiss();
    }
  });
  mCheckBox.setText(checkText);
  mCheckBox.setChecked(checked);
}

代码示例来源:origin: wangdan/AisenWeiBo

BitmapLoader.getInstance().display(this, AisenUtils.getUserPhoto(status.getUser()), imgPhoto, ImageConfigUtils.getLargePhotoConfig());
checkBox.setText(R.string.publish_cmt_to_user);
checkBox.setChecked("3".equals(getPublishBean().getParams().getParameter("is_comment")));
checkBox.setOnCheckedChangeListener(this);

代码示例来源:origin: multidots/android-app-common-tasks

@Override
      public void onClick(View v) {
        if (cbBoolean.isChecked()) {
          cbBoolean.setText("True");
          isCbSelected = true;
//                    Toast.makeText(mContext, "Selected true" + isCbSelected + ".",
//                            Toast.LENGTH_LONG).show();

          // cbBoolean.setChecked(true);
        } else {
          cbBoolean.setText("False");
          isCbSelected = false;
//                    Toast.makeText(mContext, "Selected " + isCbSelected + ".",
//                            Toast.LENGTH_LONG).show();

          // cbBoolean.setChecked(false);
        }
      }
    });

代码示例来源:origin: serso/android-checkout

public void onBind(Sku sku) {
  mSku = sku;
  mSubscription.setText(sku.getDisplayTitle());
  mSubscription.setChecked(mAdapter.isChecked(sku));
}

代码示例来源:origin: multidots/android-app-common-tasks

@Override
  public void onClick(View v) {
    // TODO Auto-generated method stub
    Common.removeAllPrefrences(mContext, getString(R.string.app_name));
    Common.setStringPrefrences(mContext, "Yes", "No", getString(R.string.app_name));
    cb_GetBoolean.setText("False");
    cb_GetBoolean.setChecked(false);
    et_GetStringPref.setText("");
    et_GetIntegerPref.setText("");
    et_GetLongPref.setText("");
    et_GetFloatPref.setText("");
  }
});

代码示例来源:origin: multidots/android-app-common-tasks

cb_GetBoolean.setText("True");
cb_GetBoolean.setText("False");

代码示例来源:origin: chrisk44/Hijacker

@Override
  public void onCheckedChanged(RadioGroup radioGroup, int i){
    titleView.setEnabled(true);
    startCmdView.setEnabled(true);
    stopCmdView.setEnabled(true);
    requirement_cb.setEnabled(true);
    has_process_name_cb.setEnabled(true);
    save_btn.setEnabled(true);
    requirement_cb.setText(i==R.id.st_rb ? R.string.requires_associated : R.string.requires_clients);
  }
});

代码示例来源:origin: chrisk44/Hijacker

fragmentView.findViewById(R.id.ap_rb).setEnabled(false);
requirement_cb.setChecked(action.requiresConnected());
requirement_cb.setText(R.string.requires_associated);

代码示例来源:origin: antest1/kcanotify

@Override
  public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    setConditionData("isdesc", b ? 1 : 0);
    chkbox_desc.setText(getStringWithLocale(b ? R.string.droplog_sort_desc : R.string.droplog_sort_asc));
  }
});

代码示例来源:origin: wbaumann/SmartReceiptsLibrary

void update(CheckBox checkBox) {
  updateView(checkBox);
  if (android_checked != null) {
    if (android_checked.equalsIgnoreCase("true")) checkBox.setChecked(true);
    else if (android_checked.equalsIgnoreCase("false")) checkBox.setChecked(false);
  }
  if (android_text != null) {
    checkBox.setText(android_text);
  }
}

代码示例来源:origin: HelloChenJinJun/TestChat

@Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if (isChecked) {
            origin.setText(getString(R.string.origin_size, previewList.get(currentPosition).getSize()));
        } else {
            origin.setText(getString(R.string.origin_text));
        }
    }
});

代码示例来源:origin: renyuneyun/Easer

@NonNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  LinearLayout linearLayout = new LinearLayout(getContext());
  linearLayout.setOrientation(LinearLayout.VERTICAL);
  for (int i = 0; i < checkBoxes.length; i++) {
    checkBoxes[i] = new CheckBox(getContext());
    checkBoxes[i].setText(mode_names[i]);
    linearLayout.addView(checkBoxes[i]);
  }
  return linearLayout;
}

代码示例来源:origin: renyuneyun/Easer

@NonNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
  LinearLayout linearLayout = new LinearLayout(getContext());
  linearLayout.setOrientation(LinearLayout.VERTICAL);
  for (int i = 0; i < checkBoxes.length; i++) {
    checkBoxes[i] = new CheckBox(getContext());
    checkBoxes[i].setText(mode_names[i]);
    linearLayout.addView(checkBoxes[i]);
  }
  return linearLayout;
}

代码示例来源:origin: lltvcn/FreeText

private void addView(String str) {
  CheckBox tv = new CheckBox(viewContainer.getContext());
  tv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
  tv.setText(str);
  viewContainer.addView(tv);
  if(obj!=null&&obj.equals(getString(str))){
    tv.setChecked(true);
  }
  tv.setOnCheckedChangeListener(lis);
}

代码示例来源:origin: EthACKdotOrg/orWall

@Override
  public void onClick(View view) {
    Log.d(TAG, "Click caught!");
    boolean checked = ((CheckBox) view).isChecked();
    int getPosition = (Integer) view.getTag();
    toggleApp(checked, getPosition);
    AppRule rule = apps.get(getPosition);
    CheckBox checkBox = (CheckBox) view;
    checkBox.setChecked(rule.isStored());
    checkBox.setText(rule.getLabel());
  }
});

代码示例来源:origin: XunMengWinter/Now

private View getCheckBox(final String name) {
  View view = getLayoutInflater().inflate(R.layout.item_column_select, null);
  CheckBox checkBox = view.findViewById(R.id.checkbox);
  checkBox.setText(name);
  checkBox.setChecked(mPreferencesHelper.isModuleSelected(name));
  checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
    mPreferencesHelper.setModuleSelected(name, isChecked);
    setFinishNow();
  });
  return view;
}

代码示例来源:origin: devunwired/custom-touch-examples

private void init() {
  mButton = new CheckBox(getContext());
  mButton.setText("Click Anywhere On Screen");
  
  addView(mButton, new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, Gravity.CENTER));
}

相关文章