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

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

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

CheckBox.getId介绍

暂无

代码示例

代码示例来源:origin: smuyyh/BookReader

@Override
  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    if (buttonView.getId() == cbVolume.getId()) {
      SettingManager.getInstance().saveVolumeFlipEnable(isChecked);
    } else if (buttonView.getId() == cbAutoBrightness.getId()) {
      if (isChecked) {
        startAutoLightness();
      } else {
        stopAutoLightness();
        ScreenUtils.saveScreenBrightnessInt255(ScreenUtils.getScreenBrightnessInt255(), AppUtils.getAppContext());
      }
    }
  }
}

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

int id = cb.getId();
if (thumbnailsselection[id]) {
  cb.setChecked(false);

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

CheckBox checkBox = ((CheckBox) v);

if (checkBox.isChecked())
{
  int checkBoxId = checkBox.getId(); // It will give you checked checkbox id..
  DisplayToast(selected);
}
else
   DisplayToast(selected);

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

public static void setCheckbox(CheckBox checkBox, LinearLayout parentLayout) {
  for (int i = 0; i < parentLayout.getChildCount(); i++) {
    if (parentLayout.getChildAt(i) instanceof CheckBox) {
      CheckBox child = (CheckBox) parentLayout.getChildAt(i);
      if (child.getId() != checkBox.getId())
        child.setChecked(false);
    }
  }
}

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

for (CheckBox cb : answerCheckBoxes) {
  if (cb.getId() == Integer.parseInt(id)) {
    cb.setChecked(true);
  }
}

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

if (mAnswerHolder.getChildCount() > 0) {
   List<String> answerList = new ArrayList<String>();
   for (int i = 0; i < mAnswerHolder.getChildCount(); i++) {
     CheckBox selected = (CheckBox) mAnswerHolder.getChildAt(i);
     if (selected.isChecked()) {
       answerList.add(selected.getId());
     }
   }
   new ChoicePosted(answerList).execute();
}

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

LinearLayout checkBoxContainerLayout= (Linearlayout)findViewById(R.id.checkbox_container);
ArrayList<String> al=new Arraylist(); 
for(int i=o;i< checkBoxContainerLayout.getChildCount();i++)
{
CheckBox checkbox=(CheckBox)checkBoxContainerLayout.getChildAt((0));
  if(checkbox.isChecked())
   {
   al.add(checkbox.getId());
   }
 }

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

ArrayList<Integer> listOfSelectedCheckBoxId=new ArrayList();
LinearLayout checkBocContainer=(LinearLayout)findViewById(R.id.checkbox_container);
for (int i = 0; i < checkBocContainer.getChildCount(); i++) 
 {
 CheckBox checkbox = (CheckBox) checkBocContainer.getChildAt(0);
  if (checkbox.isChecked())
  {
   listOfSelectedCheckBoxId.add(checkbox .getId());
  }
 }

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

selectCB.setId(position);
       selectCB.setOnClickListener(new OnClickListener() {
         public void onClick(View v) {
           // TODO Auto-generated method stub
           CheckBox cb = (CheckBox) v;
           int id = cb.getId();
           Log.i(LOG_TAG, "Clicked ? "+id);
           if(checkedVideo[id])
           {
             checkedVideo[id] = false;
             cb.setChecked(false);
           }
           else
           {
             for(int index = 0; index < count; index++)
             {
               checkedVideo[index] = false;
             }
             checkedVideo[id] = true;
             cb.setChecked(true);
             notifyDataSetChanged();
           }
         }
       });
       Log.i(LOG_TAG, "Checked ? "+checkedVideo[position]);
       selectCB.setChecked(checkedVideo[position]);

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

if(nextChild instanceof CheckBox && nextChild.getId()==cb.getId() ){
}else if (nextChild instanceof CheckBox && nextChild.getId()!=cb.getId() ){
if(nextChild instanceof CheckBox && nextChild.getId()==cb.getId() ){
  CheckBox cb2=(CheckBox) nextChild;
  cb2.setChecked(false);
}else if (nextChild instanceof CheckBox && nextChild.getId()!=cb.getId() ){
  CheckBox cb2=(CheckBox) nextChild;
  cb2.setChecked(false);

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

//Try this
         private boolean[] selection;   
         thumbnailsselection = new boolean[myIntegerArrayList.size()];         
//put below code in getview method                          
         holder.checkbox.setId(position);
         viewHolder.imageView .setId(position);
   holder.checkbox.setOnClickListener(new OnClickListener()
   {
     public void onClick(View v) {
       System.out.println("click-1");
       // TODO Auto-generated method stub
       CheckBox cb = (CheckBox) v;
       int id = cb.getId();
       if (selection[id])
                 {
         cb.setChecked(false);
         selection[id] = false;
       } else {
         cb.setChecked(true);
         selection[id] = true;
       }
     }
   });
         holder.checkbox.setChecked(selection[position]);
         holder.id = position;

代码示例来源:origin: posm/OpenMapKitAndroid

public String getSemiColonDelimitedTagValues(String customValues) {
    Set<String> values = new HashSet<>();
    for (CheckBox cb : checkBoxes) {
      if (cb.isChecked()) {
        int id = cb.getId();
        ODKTagItem item = buttonIdToODKTagItemHash.get(id);
        if (item != null) {
          values.add(item.getValue());
        }
      }
    }
    if (customValues != null) {
      customValues = customValues.trim();
      String[] customValuesArr = customValues.split(";");
      if (customValuesArr.length > 0) {
        for (int i = 0; i < customValuesArr.length; i++) {
          String customVal = customValuesArr[i];
          values.add(customVal);
        }
      }
    }
    return StringUtils.join(values, ";");
  }
}

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

public void onClick(View v) {       
  if (chk.getId() == 101) {
    if (chk.isChecked()) {
      for (int a = 1; a < tblItemDetail.getChildCount(); a++) {
      for (int a = 0; a < itemContainer.length; a++) {
        for (int b = 0; b < itemContainer[a].length; b++) {
          if (a == chk.getId()) {
            itemContainer[a][6] = "Y";                                  
      for (int a = 0; a < itemContainer.length; a++) {
        for (int b = 0; b < itemContainer[a].length; b++) {
          if (a == chk.getId()) {
            itemContainer[a][6] = "N";

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

public void onClick(View v) {
  CheckBox cb = (CheckBox) v;
  checkboxesState[cb.getId()] = cb.isChecked();

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

int id = cb.getId();
if (thumbnailsselection[id]) {
  cb.setChecked(false);

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

int id = cb.getId();
if (thumbnailsselection[id]){
  cb.setChecked(false);

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

int id = cb.getId();
if (thumbnailsselection[id]) {
  cb.setChecked(false);

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

public void onClick(View v) {
  CheckBox cb = (CheckBox) v;
  int id = cb.getId();
  if (thumbnailsselection[id]) {
    cb.setChecked(false);

代码示例来源:origin: CooLoongWu/CoolChat

checkbox_audio.setChecked(checkbox_audio.getId() == checkedId);
checkbox_emoji.setChecked(checkbox_emoji.getId() == checkedId);
checkbox_gallery.setChecked(false);
checkbox_video.setChecked(false);
checkbox_more.setChecked(checkbox_more.getId() == checkedId);

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

storeAnswer(cb.getId(), answer);

相关文章