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

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

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

CheckBox.setOnCheckedChangeListener介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

private void initializeViewListeners() {
  mEmailView.addTextChangedListener(this);
  mPasswordView.addTextChangedListener(this);
  mClientCertificateCheckBox.setOnCheckedChangeListener(this);
  mClientCertificateSpinner.setOnClientCertificateChangedListener(this);
  mShowPasswordCheckBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      showPassword(isChecked);
    }
  });
}

代码示例来源:origin: TeamNewPipe/NewPipe

private void setupSkipSilenceControl(@NonNull View rootView) {
  skipSilenceCheckbox = rootView.findViewById(R.id.skipSilenceCheckbox);
  if (skipSilenceCheckbox != null) {
    skipSilenceCheckbox.setChecked(initialSkipSilence);
    skipSilenceCheckbox.setOnCheckedChangeListener((compoundButton, isChecked) ->
        setCurrentPlaybackParameters());
  }
}

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

RowController(ChoiceCapableAdapter adapter, View row) {
 super(row);
 this.adapter=adapter;
 label=(TextView)row.findViewById(R.id.label);
 size=(TextView)row.findViewById(R.id.size);
 icon=(ImageView)row.findViewById(R.id.icon);
 cb=(CheckBox)row.findViewById(R.id.cb);
 template=size.getContext().getString(R.string.size_template);
 row.setOnClickListener(this);
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  row.setOnTouchListener(new View.OnTouchListener() {
   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
   @Override
   public boolean onTouch(View v, MotionEvent event) {
    v
      .findViewById(R.id.row_content)
      .getBackground()
      .setHotspot(event.getX(), event.getY());
    return(false);
   }
  });
 }
 cb.setOnCheckedChangeListener(this);
}

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

RowController(ChoiceCapableAdapter adapter, View row) {
 super(row);
 this.adapter=adapter;
 label=(TextView)row.findViewById(R.id.label);
 size=(TextView)row.findViewById(R.id.size);
 icon=(ImageView)row.findViewById(R.id.icon);
 cb=(CheckBox)row.findViewById(R.id.cb);
 template=size.getContext().getString(R.string.size_template);
 row.setOnClickListener(this);
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  row.setOnTouchListener(new View.OnTouchListener() {
   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
   @Override
   public boolean onTouch(View v, MotionEvent event) {
    v
      .findViewById(R.id.row_content)
      .getBackground()
      .setHotspot(event.getX(), event.getY());
    return(false);
   }
  });
 }
 cb.setOnCheckedChangeListener(this);
}

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

RowController(ChoiceCapableAdapter adapter, View row) {
 super(row);
 this.adapter=adapter;
 label=(TextView)row.findViewById(R.id.label);
 size=(TextView)row.findViewById(R.id.size);
 icon=(ImageView)row.findViewById(R.id.icon);
 cb=(CheckBox)row.findViewById(R.id.cb);
 template=size.getContext().getString(R.string.size_template);
 row.setOnClickListener(this);
 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
  row.setOnTouchListener(new View.OnTouchListener() {
   @TargetApi(Build.VERSION_CODES.LOLLIPOP)
   @Override
   public boolean onTouch(View v, MotionEvent event) {
    v
      .findViewById(R.id.row_content)
      .getBackground()
      .setHotspot(event.getX(), event.getY());
    return(false);
   }
  });
 }
 cb.setOnCheckedChangeListener(this);
}

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

@Override
public void onCreate(Bundle state) {
 super.onCreate(state);
 setContentView(R.layout.main);
 cb=(CheckBox)findViewById(R.id.check);
 cb.setOnCheckedChangeListener(this);
}

代码示例来源:origin: niorgai/StatusBarCompat

protected void initCheckBox() {
  if (getView() == null) {
    return;
  }
  mCheckBox = getView().findViewById(R.id.light_status_bar);
  mCheckBox.setOnCheckedChangeListener(this);
}

代码示例来源:origin: TeamNewPipe/NewPipe

private void setupHookingControl(@NonNull View rootView) {
  unhookingCheckbox = rootView.findViewById(R.id.unhookCheckbox);
  if (unhookingCheckbox != null) {
    unhookingCheckbox.setChecked(pitch != tempo);
    unhookingCheckbox.setOnCheckedChangeListener((compoundButton, isChecked) -> {
      if (isChecked) return;
      // When unchecked, slide back to the minimum of current tempo or pitch
      final double minimum = Math.min(getCurrentPitch(), getCurrentTempo());
      setSliders(minimum);
      setCurrentPlaybackParameters();
    });
  }
}

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

@Override
public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.main);
 CheckBox cb=(CheckBox)findViewById(R.id.showCalendar);
 if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.HONEYCOMB) {
  cb.setOnCheckedChangeListener(this);
 }
 else {
  cb.setVisibility(View.GONE);
 }
 GregorianCalendar now=new GregorianCalendar();
 picker=(DatePicker)findViewById(R.id.picker);
 picker.init(now.get(Calendar.YEAR), now.get(Calendar.MONTH),
       now.get(Calendar.DAY_OF_MONTH), this);
}

代码示例来源:origin: facebook/litho

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_render_thread);
 mLithoView = (LithoView) findViewById(R.id.lithoView);
 buildAndSetComponentTree(true);
 CheckBox checkRT = (CheckBox) findViewById(R.id.checkRT);
 checkRT.setChecked(true);
 checkRT.setOnCheckedChangeListener(this);
}

代码示例来源:origin: Jacksgong/JKeyboardPanelSwitch

.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  @Override
  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

代码示例来源:origin: liaoinstan/SpringView

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_test);
  ((RadioGroup) findViewById(R.id.group_type)).setOnCheckedChangeListener(this);
  ((RadioGroup) findViewById(R.id.group_give)).setOnCheckedChangeListener(this);
  ((CheckBox) findViewById(R.id.check_enableheader)).setOnCheckedChangeListener(this);
  ((CheckBox) findViewById(R.id.check_enableFooter)).setOnCheckedChangeListener(this);
  springView = findViewById(R.id.my);
  springView.setListener(new SpringView.OnFreshListener() {
    @Override
    public void onRefresh() {
      Toast.makeText(TestActivity.this, "onRefresh", Toast.LENGTH_SHORT).show();
      new Handler().postDelayed(() -> springView.onFinishFreshAndLoad(), 1000);
    }
    @Override
    public void onLoadmore() {
      Toast.makeText(TestActivity.this, "onLoadmore", Toast.LENGTH_SHORT).show();
      new Handler().postDelayed(() -> springView.onFinishFreshAndLoad(), 1000);
    }
  });
}

代码示例来源:origin: qiujuer/Genius-Android

private void initBlur() {
  // Find Bitmap
  mBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_blur);
  //Bitmap.Config config = mBitmap.getConfig();
  //mBitmap = mBitmap.copy(Bitmap.Config.RGB_565, true);
  //mBitmap = compressImage(mBitmap);
  mImageJava = (ImageView) findViewById(R.id.image_blur_java);
  mImageJniPixels = (ImageView) findViewById(R.id.image_blur_jni_pixels);
  mImageJniBitmap = (ImageView) findViewById(R.id.image_blur_jni_bitmap);
  mTime = (TextView) findViewById(R.id.text_blur_time);
  // Init src image
  ((ImageView) findViewById(R.id.image_blur_self)).setImageBitmap(mBitmap);
  // Compress and Save Bitmap
  Matrix matrix = new Matrix();
  matrix.postScale(1.0f / SCALE_FACTOR, 1.0f / SCALE_FACTOR);
  // New Compress bitmap
  mCompressBitmap = Bitmap.createBitmap(mBitmap, 0, 0,
      mBitmap.getWidth(), mBitmap.getHeight(), matrix, true);
  mCompressBitmap = mCompressBitmap.copy(Bitmap.Config.RGB_565, true);
  // Set On OnCheckedChangeListener
  CheckBox checkBox = (CheckBox) findViewById(R.id.checkbox_blur_isCompress);
  checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      mCompress = isChecked;
      applyBlur();
    }
  });
}

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

this.myListener = listener;
myCheckBox.setOnCheckedChangeListener(listener);

代码示例来源:origin: lygttpod/SuperTextView

/**
 * 初始化RightCheckBox
 */
private void initRightCheckBox() {
  if (rightCheckBox == null) {
    rightCheckBox = new CheckBox(mContext);
  }
  rightCheckBoxParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  rightCheckBoxParams.addRule(ALIGN_PARENT_RIGHT, TRUE);
  rightCheckBoxParams.addRule(RelativeLayout.CENTER_VERTICAL, TRUE);
  rightCheckBoxParams.setMargins(0, 0, rightCheckBoxMarginRight, 0);
  rightCheckBox.setId(R.id.sRightCheckBoxId);
  rightCheckBox.setLayoutParams(rightCheckBoxParams);
  if (rightCheckBoxBg != null) {
    rightCheckBox.setGravity(CENTER_IN_PARENT);
    rightCheckBox.setButtonDrawable(rightCheckBoxBg);
  }
  rightCheckBox.setChecked(isChecked);
  rightCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      if (checkBoxCheckedChangeListener != null) {
        checkBoxCheckedChangeListener.onCheckedChanged(buttonView, isChecked);
      }
    }
  });
  addView(rightCheckBox);
}

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

@Override
protected void layoutInit(LayoutInflater inflater, Bundle savedInstanceState) {
  super.layoutInit(inflater, savedInstanceState);
  
  btnOverflow.setVisibility(View.GONE);
  
  editContent.setHint(R.string.publish_cmt_def);
  
  StatusContent status = getPublishBean().getStatusContent();
  txtContent.setText(AisenUtils.getCommentText(status.getText()));
  if (status.getUser() != null)
    BitmapLoader.getInstance().display(this, AisenUtils.getUserPhoto(status.getUser()), imgPhoto, ImageConfigUtils.getLargePhotoConfig());
  checkBox.setChecked(Boolean.parseBoolean(getPublishBean().getExtras().getParameter("forward")));
  checkBox.setOnCheckedChangeListener(this);
  ((BaseActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  ((BaseActivity) getActivity()).getSupportActionBar().setTitle(R.string.title_cmt_status);
}

代码示例来源:origin: rockerhieu/emojicon

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  mEditEmojicon = (EmojiconEditText) findViewById(R.id.editEmojicon);
  mTxtEmojicon = (EmojiconTextView) findViewById(R.id.txtEmojicon);
  mEditEmojicon.addTextChangedListener(new TextWatcherAdapter() {
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
      mTxtEmojicon.setText(s);
    }
  });
  mCheckBox = (CheckBox) findViewById(R.id.use_system_default);
  mCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
      mEditEmojicon.setUseSystemDefault(b);
      mTxtEmojicon.setUseSystemDefault(b);
      setEmojiconFragment(b);
    }
  });
  setEmojiconFragment(false);
}

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

cbVolume.setOnCheckedChangeListener(new ChechBoxChangeListener());
cbAutoBrightness.setOnCheckedChangeListener(new ChechBoxChangeListener());

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

@Override
protected void layoutInit(LayoutInflater inflater, Bundle savedInstanceState) {
  super.layoutInit(inflater, savedInstanceState);
  
  btnOverflow.setVisibility(View.GONE);
  
  editContent.setHint(R.string.publish_cmt_def);
  if (getPublishBean().getExtras() != null && getPublishBean().getExtras().containsKey("append"))
    editContent.setText(getPublishBean().getExtras().getParameter("append"));
  
  StatusComment mComment = getPublishBean().getStatusComment();
  txtContent.setText(AisenUtils.getCommentText(mComment.getText()));
  if (mComment.getUser() != null)
    BitmapLoader.getInstance().display(this, AisenUtils.getUserPhoto(mComment.getUser()), imgPhoto, ImageConfigUtils.getLargePhotoConfig());
  checkBox.setChecked(Boolean.parseBoolean(getPublishBean().getExtras().getParameter("forward")));
  checkBox.setOnCheckedChangeListener(this);
  ((BaseActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  ((BaseActivity) getActivity()).getSupportActionBar().setTitle(R.string.title_reply_cmt);
}

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

ckBoxSelect.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
  @Override
  public void onCheckedChanged(CompoundButton buttonView,

相关文章