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

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

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

CheckBox.performClick介绍

暂无

代码示例

代码示例来源:origin: robolectric/robolectric

@Test
 public void testWorks() throws Exception {
  CheckBox checkBox = new CheckBox(ApplicationProvider.getApplicationContext());
  assertThat(checkBox.isChecked()).isFalse();

  checkBox.setChecked(true);
  assertThat(checkBox.isChecked()).isTrue();

  checkBox.toggle();
  assertThat(checkBox.isChecked()).isFalse();

  checkBox.performClick();  // Used to support performClick(), but Android doesn't. Sigh.
//        assertThat(checkBox.isChecked()).isFalse();
 }
}

代码示例来源:origin: kinecosystem/kin-ecosystem-android-sdk

@Override
  public void onClick(View v) {
    iUnderstandCheckbox.performClick();
  }
});

代码示例来源:origin: DoodleScheduling/android-material-chips

@Override
  public void onClick(View v) {
    selection.performClick();
  }
});

代码示例来源:origin: RedInput/Notification-Blocker

@Override
  public void onClick(View v) {
    hide.performClick();
  }
});

代码示例来源:origin: kinecosystem/kin-ecosystem-android-sdk

@Override
  public void onClick(View v) {
    iHaveSavedCheckbox.performClick();
  }
});

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

@Override
public void onClick(View v) {
  switch (v.getId()) {
    case R.id.activity_settings_bluetooth_section:
      bluetoothSwitch.performClick();
      break;
  }
}

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

@Override
  public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) {
    // TODO Auto-generated method stub
    CheckBox cb = (CheckBox) v.findViewById(R.id.chkSelected);
    TextView tv = (TextView) v.findViewById(R.id.tvName);
//        pi = (PackageInfo) arg0.getItemAtPosition(position);
    cb.performClick();
    if (cb.isChecked()) {
      studentList.add(tv.getText().toString());
    } else if (!cb.isChecked()) {
      studentList.remove(tv.getText().toString());
    }
  }

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

@Override
  public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) {
    // TODO Auto-generated method stub
    CheckBox cb = (CheckBox) v.findViewById(R.id.chkSelected);
    TextView tv = (TextView) v.findViewById(R.id.tvName);
//        pi = (PackageInfo) arg0.getItemAtPosition(position);
    cb.performClick();
    if (cb.isChecked()) {
      checkedValue.add(tv.getText().toString());
    } else if (!cb.isChecked()) {
      checkedValue.remove(tv.getText().toString());
    }
  }

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

@Override
public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) {
  // TODO Auto-generated method stub
  CheckBox cb = (CheckBox) v.findViewById(R.id.checkBox1);
  TextView tv = (TextView) v.findViewById(R.id.textView1);
  pi = (PackageInfo) arg0.getItemAtPosition(position);
  cb.performClick();
  if (cb.isChecked()) {
    checkedValue.add(tv.getText().toString());
  } else if (!cb.isChecked()) {
    checkedValue.remove(tv.getText().toString());
  }
}

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

enter code here
@Override
  public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) {
    // TODO Auto-generated method stub
    CheckBox cb = (CheckBox) v.findViewById(R.id.checkBox1);
    TextView tv = (TextView) v.findViewById(R.id.textView1);
    pi = (PackageInfo) arg0.getItemAtPosition(position);
    cb.performClick();
    if (cb.isChecked()) {
      checkedValue.add(tv.getText().toString());
    } else if (!cb.isChecked()) {
      checkedValue.remove(tv.getText().toString());
    }
  }

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

list.setOnItemClickListener(new OnItemClickListener() {
   public void onItemClick(AdapterView<?> parent, View view,
       int position, long id) {
     CheckBox cb = (CheckBox) view.findViewById(R.id.chkbox);
     cb.performClick();
     if (cb.isChecked()) {
   /*
       for (int i = 0; i < adapter.getCount(); i++) {
         if (adapter.checkedHolder[i]) {
           // get all name values that checked by user
           MemberName.clear();
           MemberName.add(ItemsArr.get(i).getItemName().toString());
           cb.setChecked(true);
           Log.i(TAG, "Name " + MemberName);
           // Name = ItemsArr.get(i).getItemName().toString();
           //Log.i(TAG, "Name " + Name);
         } */
    //SEARCH POSITION WHERE ARE TRUE
     for(Integer i : mapCheck.keySet())
     {
    if(mapCheck.get(i) == true)
     {
      cb.setChecked(true);
     }
    }
       }
     } else if (!cb.isChecked()) {
     }
   }
 });

代码示例来源:origin: proninyaroslav/libretorrent

@Override
public void onClick(View v)
{
  int position = getAdapterPosition();
  if (listener != null && position >= 0) {
    BencodeFileTree file = files.get(position);
    if (file.getType() == FileNode.Type.FILE) {
      /* Check file if it clicked */
      fileSelected.performClick();
    }
    listener.onItemClicked(file);
  }
}

代码示例来源:origin: dsolonenko/financisto

switch (id) {
  case R.id.include_subcategories:
    cbIncludeSubCategories.performClick();
    break;
  case R.id.include_credit:
    cbIncludeCredit.performClick();
    break;
  case R.id.budget_mode:
    cbMode.performClick();
    break;
  case R.id.type:
    cbSavingBudget.performClick();
    break;
  case R.id.category:

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

@Override
public void onClick(View v) {
  radios.performClick();

代码示例来源:origin: luhaoaimama1/zone-sdk

cb.performClick();

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

cb.performClick();
if (cb.isChecked()) {

代码示例来源:origin: dsolonenko/financisto

@Override
protected void onClick(View v, int id) {
  switch (id) {
    case R.id.is_included_into_totals:
      isIncludedIntoTotals.performClick();
      break;
    case R.id.account_type:
      x.selectPosition(this, R.id.account_type, R.string.account_type, accountTypeAdapter, AccountType.valueOf(account.type).ordinal());
      break;
    case R.id.card_issuer:
      x.selectPosition(this, R.id.card_issuer, R.string.card_issuer, cardIssuerAdapter,
          account.cardIssuer != null ? CardIssuer.valueOf(account.cardIssuer).ordinal() : 0);
      break;
    case R.id.electronic_payment_type:
      x.selectPosition(this, R.id.electronic_payment_type, R.string.electronic_payment_type, electronicPaymentAdapter,
          selectEnum(ElectronicPaymentType.class, account.cardIssuer, ElectronicPaymentType.PAYPAL).ordinal());
      break;
    case R.id.currency:
      x.select(this, R.id.currency, R.string.currency, currencyCursor, currencyAdapter,
          "_id", account.currency != null ? account.currency.id : -1);
      break;
    case R.id.currency_add:
      addNewCurrency();
      break;
  }
}

相关文章