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

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

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

CheckBox.getTag介绍

暂无

代码示例

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

int clickedPos = ((Integer)cb.getTag()).intValue();

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

public void onClick(View v) {
  CheckBox cb = (CheckBox) v;
  Contact contact = (Contact) cb.getTag();
  contact.setChecked(cb.isChecked());

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

@Override
 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
   CheckBox chk = (CheckBox) buttonView;
   if (chk.isChecked()) {
     items.set(chk.getTag(), 1);
   } else {
     items.set(chk.getTag(), 0);
   }
   /*mySaprseBooleanArray.put((Integer) buttonView.getTag(), isChecked);*/
 }

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

public void onClick(View v) {
 CheckBox cb = (CheckBox) v;
 if(cb.isChecked()) {
  list.add((Integer) cb.getTag());
 }
}

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

holder.check.setOnClickListener(new View.OnClickListener() {
         @Override
         public void onClick(View v) {
           CheckBox cb = (CheckBox) v;
           Item changeItem = (Item) cb.getTag();
           changeItem.setStatus(cb.isChecked() ? 1 : 0);
           mDbHelper.updateItem(changeItem);
              }
          });

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

CheckBox cb = (CheckBox) v;
Country country = (Country) cb.getTag();
country.setSelected(cb.isChecked());  // add this line

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

for (CheckBox checkbox : eyes_views)
{
  if (checkbox.isChecked())
  {
     eyes=eyes.concat(checkbox.getTag()+",");
  }
}

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

holder.rowCheckBox.setOnClickListener(new View.OnClickListener() {
     @Override
     public void onClick(View v) {
       CheckBox cb = (CheckBox)v;
       HEADER element = (HEADER) cb.getTag();
       if (cb.isChecked()) {
             CreateGroupHelperClass.unSelectedUsers.remove(element);
             CreateGroupHelperClass.selectedUsers.add(element);
           }
           else {
             CreateGroupHelperClass.selectedUsers.remove(element);
             CreateGroupHelperClass.unSelectedUsers.add(element);
           }
     }
   });

代码示例来源:origin: Chion82/WeChatMomentStat-Android

protected CheckBox getUserCheckBox(String userId) {
    for (int i=0;i<checkBoxList.size();i++) {
      if (checkBoxList.get(i).getTag().equals(userId)) {
        return checkBoxList.get(i);
      }
    }
    return checkBoxList.get(0);
  }
}

代码示例来源:origin: Meiqia/MeiqiaSDK-Android

@Override
public Object getValue() {
  JSONArray checkedArray = new JSONArray();
  for (CheckBox checkBox : checkBoxList) {
    if (checkBox.isChecked()) {
      checkedArray.put(checkBox.getTag());
    }
  }
  return checkedArray;
}

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

public void selectItem(View view){
  Set<String> output = new HashSet(); // here could be ArrayList also OK
  for(CheckBox ch : allMyCheckBoxes){
    if(ch.isChecked()){
      output.add(ch.getTag());
    }
  }
  showOutPut(output);
}

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

@NonNull
private List<Scope> getCheckedScopes() {
  final boolean useAllScopes = scopeAllCheckbox.isChecked();
  final List<Scope> scopes = new ArrayList<>();
  for (final CheckBox checkBox : scopeCheckBoxes) {
    if (useAllScopes || checkBox.isChecked()) {
      scopes.add((Scope) checkBox.getTag());
    }
  }
  return scopes;
}

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

listView.setOnItemClickListener(new OnItemClickListener()
   {
     public void onItemClick(AdapterView<?> parent, View view, int position, long id)
     {
       AppListOfAllApps hideSelectedApps = (AppListOfAllApps) parent.getItemAtPosition(position);
       if (view != null)
       {
         CheckBox checkBox = (CheckBox) view.findViewById(R.id.checkBox1);
         hideSelectedApps = (AppListOfAllApps) checkBox.getTag();
         hideSelectedApps.setSelected(!checkBox.isChecked());
         checkBox.setChecked(!checkBox.isChecked());
       }
     }
   });

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

OnClickListener listener = new OnClickListener() {
   @Override
   public void onClick(View v) {
      CheckBox cb = (CheckBox) v ;  
      // here your code
      if(cb.isChecked()){
        ObjectViews object = (ObjectViews) cb.getTag();
        String text = object.getText1().getText();
        Toast.makeText(context,text, Toast.LENGTH_LONG).show();
      }
   }
 };

代码示例来源:origin: marzika/Snapprefs

public void onClick(View v) {
    CheckBox cb = (CheckBox) v;
    Friend contact = (Friend) cb.getTag();
    contact.setSelected(cb.isChecked());
    friendList.get(pos).setSelected(cb.isChecked());
  }
});

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

OnClickListener checkBoxOnClickLister = new OnClickListener() {
  @Override
  public void onClick(View v) {
    CheckBox checkBox = ((CheckBox) v);
    String currentTag = (String) checkBox.getTag();

    if (checkBox.isChecked()) {
      Log.i("ulog", "is checked " + currentTag);

    } else {
      Log.i("ulog", "not checked " + currentTag);
    }
  }
};

for (int i = 0; i < len; i++) {
  currentCheckBox = (CheckBox) optionsContainer.getChildAt(i);
  currentCheckBox.setOnClickListener(checkBoxOnClickLister);
}

代码示例来源:origin: marzika/Snapprefs

public void onClick(View v) {
    CheckBox cb = (CheckBox) v;
    Friend contact = (Friend) cb.getTag();
    contact.setSelected(cb.isChecked());
    friendList.get(pos).setSelected(cb.isChecked());
  }
});

代码示例来源:origin: oswaldo89/LatestPhotoGallery-library

public void onClick(View v) {
    CheckBox cb = (CheckBox) v;
    Image contact = (Image) cb.getTag();
    contact.setSelected(cb.isChecked());
    item.get(i).setSelected(cb.isChecked());
  }
});

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

public View getView(int position, View convertView, ViewGroup parent) {

if (convertView == null){
  LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  convertView = vi.inflate(R.layout.pitanja_entry, null);

  holder = new ViewHolder();
  holder.code = (TextView) convertView.findViewById(R.id.code);
  holder.code.setTypeface(custom_font);
  holder.name = (CheckBox) convertView.findViewById(R.id.checkBox1);
  convertView.setTag(holder);

  holder.name.setOnClickListener(new View.OnClickListener(){

    @Override
    public void onClick(View v) {

      CheckBox cb = (CheckBox) v;
      Odgovor country = (Odgovor) cb.getTag();
      country.setSelected(cb.isChecked());

    }

代码示例来源:origin: dalong982242260/FlowLayout

/**
 * 设置不可点击项
 * @param position  位置
 */
public void setUnEnable(int position) {
  for (int i = 0; i < getChildCount(); i++) {
    CheckBox chk = (CheckBox) getChildAt(i).findViewById(R.id.single_select_chk);
    int tag = (Integer) chk.getTag();
    if (tag == position)
      setUnEnabled(chk);
  }
}

相关文章