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

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

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

CheckBox.setClickable介绍

暂无

代码示例

代码示例来源:origin: GitLqr/LQRWeChat

@Override
  public void convert(LQRViewHolderForRecyclerView helper, GroupMember item, int position) {
    helper.setText(R.id.tvName, item.getName()).setViewVisibility(R.id.cb, View.VISIBLE);
    ImageView ivHeader = helper.getView(R.id.ivHeader);
    Glide.with(RemoveGroupMemberActivity.this).load(item.getPortraitUri()).centerCrop().into(ivHeader);
    CheckBox cb = helper.getView(R.id.cb);
    cb.setClickable(true);
    cb.setChecked(mSelectedData.contains(item) ? true : false);
    cb.setOnClickListener(v -> {
      if (cb.isChecked()) {
        mSelectedData.add(item);
      } else {
        mSelectedData.remove(item);
      }
      if (mSelectedData.size() > 0) {
        mBtnToolbarSend.setEnabled(true);
        mBtnToolbarSend.setText(UIUtils.getString(R.string.delete) + "(" + mSelectedData.size() + ")");
      } else {
        mBtnToolbarSend.setEnabled(false);
        mBtnToolbarSend.setText(UIUtils.getString(R.string.delete));
      }
    });
  }
};

代码示例来源:origin: chat-sdk/chat-sdk-android

public UserViewHolder(View view) {
    super(view);
    nameTextView = view.findViewById(R.id.chat_sdk_txt);
    statusTextView = view.findViewById(R.id.tvStatus);
    availabilityImageView = view.findViewById(R.id.ivAvailability);
    avatarImageView = view.findViewById(R.id.img_profile_picture);
    checkBox = view.findViewById(R.id.checkbox);
    // Clicks are handled at the list item level
    checkBox.setClickable(false);
  }
}

代码示例来源:origin: stackoverflow.com

for (CheckBox cb : answerCheckBoxes){
  if (cb != null) {
    cb.setChecked(false);
    cb.setClickable(true);
  }
}

代码示例来源:origin: openmrs/openmrs-contrib-android-client

public void disableCheckBox(PatientViewHolder holder) {
  holder.mAvailableOfflineCheckbox.setChecked(true);
  holder.mAvailableOfflineCheckbox.setClickable(false);
  holder.mAvailableOfflineCheckbox.setButtonDrawable(R.drawable.ic_offline);
}

代码示例来源:origin: stackoverflow.com

cbTwo.setClickable(false);
cbThree.setClickable(false);
cbTwo.setClickable(true);
cbThree.setClickable(true);
cbOne.setClickable(false);
cbThree.setClickable(false);
cbOne.setClickable(true);
cbThree.setClickable(true);
cbTwo.setClickable(false);
cbOne.setClickable(false);
cbTwo.setClickable(true);
cbOne.setClickable(true);

代码示例来源:origin: stackoverflow.com

public BooleanAdapter(Context context)
{   
  AbsListView.LayoutParams lp = new AbsListView.LayoutParams(AbsListView.LayoutParams.WRAP_CONTENT, AbsListView.LayoutParams.WRAP_CONTENT);
  TextView txt = new TextView(context);
  txt.setText("Clear filter");
  txt.setLayoutParams(lp);
  values.add(txt);

  CheckBox cb1 = new CheckBox(context);
  cb1.setClickable(false);
  cb1.setChecked(true);
  cb1.setLayoutParams(lp);
  values.add(cb1);

  CheckBox cb2 = new CheckBox(context);
  cb2.setClickable(false);
  cb2.setChecked(false);
  cb2.setLayoutParams(lp);
  values.add(cb2);
}

代码示例来源:origin: offensive-security/nethunter-app

public void onClick(View v){
    if (whitelist.isChecked()){
      white_me.setClickable(true);
      String check_me = exe.RunAsRootOutput("grep -q " + getmac(wlan.getText().toString()) + " \"/sdcard/nh_files/deauth/whitelist.txt\" && echo $?");
      if (check_me.contains("0")){
        white_me.setChecked(true);
      }
      else{
        white_me.setChecked(false);
      }
    }
    else{
      white_me.setChecked(false);
      white_me.setClickable(false);
    }
  }
});

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

ck = (CheckBox) itemView.findViewById(R.id.ck);
ck.setChecked(false);
ck.setClickable(false);
ck.setFocusable(false);
itemView.setOnClickListener(new View.OnClickListener() {

代码示例来源:origin: nvllsvm/Audinaut

public SettingView(Context context) {
  super(context, false);
  this.context = context;
  LayoutInflater.from(context).inflate(R.layout.basic_choice_item, this, true);
  titleView = findViewById(R.id.item_name);
  checkBox = findViewById(R.id.item_checkbox);
  checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
    if (item != null) {
      item.setValue(isChecked);
    }
  });
  checkBox.setClickable(false);
}

代码示例来源:origin: stackoverflow.com

layoutParams.rightMargin = 30;
checkBox.setLayoutParams(layoutParams);
checkBox.setClickable(false);
if (selectedList != null) {
  checkBox.setChecked(selectedList.get(position));

代码示例来源:origin: casific/murmur

boolean isChecked = cursor.getInt(checked_colIndex) == MessageStore.TRUE;
  viewHolder.checkbox.setChecked(isChecked);
  viewHolder.checkbox.setClickable(false);
  viewHolder.itemContainer.setBackground(new ColorDrawable(isChecked ? checkedBgColor : normalBgColor));
} else {

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

if (!service.isOnline()) {
  checkBox.setEnabled(true);
  checkBox.setClickable(true);
  checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
  checkBox.setClickable(false);
  checkBox.setChecked(false);

代码示例来源:origin: JmStefanAndroid/PVCloudGroupn

@Override
protected void convert(BaseViewHolder viewHoder, final Address item) {
  viewHoder.getTextView(R.id.txt_name).setText(item.getConsignee());
  viewHoder.getTextView(R.id.txt_phone).setText(replacePhoneNum(item.getPhone()));
  viewHoder.getTextView(R.id.txt_address).setText(item.getAddr());
  final CheckBox checkBox = viewHoder.getCheckBox(R.id.cb_is_defualt);
  final boolean isDefault = item.getIsDefault();
  checkBox.setChecked(isDefault);
  if(isDefault){
    checkBox.setText("默认地址");
  }
  else{
    checkBox.setClickable(true);
    checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
      @Override
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        if(isChecked && lisneter !=null){
          item.setIsDefault(true);
          lisneter.setDefault(item);
        }
      }
    });
  }
}

相关文章