android.widget.Switch.setChecked()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(346)

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

Switch.setChecked介绍

暂无

代码示例

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

/**
 * @param checked Switch是否选中
 * @return 返回值
 */
public SuperTextView setSwitchIsChecked(boolean checked) {
  switchIsChecked = checked;
  if (mSwitch != null) {
    mSwitch.setChecked(checked);
  }
  return this;
}

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

private void setPermissionsSwitches() {
    Set<String> permissions = AccessToken.getCurrentAccessToken().getPermissions();

    if (permissions.contains(EMAIL)) {
      mEmailPermSwitch.setChecked(true);
    } else {
      mEmailPermSwitch.setChecked(false);
    }

    if (permissions.contains(USER_POSTS)) {
      mUserPostsPermSwitch.setChecked(true);
    } else {
      mUserPostsPermSwitch.setChecked(false);
    }

    if (permissions.contains(PUBLISH_ACTIONS)) {
      mPublishPostPermSwitch.setChecked(true);
    } else {
      mPublishPostPermSwitch.setChecked(false);
    }

    if (AccessToken.getCurrentAccessToken() != null) {
      mAppPermSwitch.setChecked(true);
    } else {
      mAppPermSwitch.setChecked(false);
    }
  }
}

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

private void onConnectionError(Throwable t) {
 Log.e(TAG, "Exception from Bluetooth", t);
 binding.connected.setChecked(false);
 Toast.makeText(getActivity(), R.string.msg_connect_error, Toast.LENGTH_LONG).show();
}

代码示例来源:origin: xfumihiro/ViewInspector

@Override public void onViewRootSelected(View view) {
 interceptor.setViewRoot(view);
 mProbeMeasureSwitch.setChecked(true);
}

代码示例来源:origin: xfumihiro/ViewInspector

public SettingsMenu(final Context context) {
  super(context);
  ViewInspector.runtimeComponentMap.get(context).inject(this);

  inflate(context, R.layout.view_inspector_settings_menu, this);

  Switch logViewEventsSwitch = (Switch) findViewById(R.id.log_view_events_switch);
  logViewEventsSwitch.setChecked(logViewEvents.get());
  logViewEventsSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
   @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    logViewEvents.set(isChecked);
   }
  });

  View viewFilter = findViewById(R.id.view_filter);
  viewFilter.setOnClickListener(new OnClickListener() {
   @Override public void onClick(View v) {
    new SetViewFilterDialog(
      new ContextThemeWrapper(context, BaseDialog.getDialogTheme(context))).show();
   }
  });
 }
}

代码示例来源:origin: xfumihiro/ViewInspector

outlineSwitch.setChecked(showOutline.get());
outlineSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
marginSwitch.setChecked(showMargin.get());
marginSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
paddingSwitch.setChecked(showPadding.get());
paddingSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

代码示例来源:origin: xfumihiro/ViewInspector

scalpel3dSwitch.setChecked(scalpel3d.get());
scalpel3dSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
scalpelWireframeSwitch.setChecked(scalpelWireframe.get());
scalpelWireframeSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
scalpelIdSwitch.setChecked(scalpelId.get());
scalpelIdSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

代码示例来源:origin: xfumihiro/ViewInspector

mProbeMeasureSwitch.setChecked(probeMeasures.get());
mProbeMeasureSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
showMeasureCountSwitch.setChecked(showMeasureCount.get());
showMeasureCountSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
 @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

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

mSwitch.setLayoutParams(mSwitchParams);
mSwitch.setChecked(switchIsChecked);
if (!TextUtils.isEmpty(mTextOff)) {
  mSwitch.setTextOff(mTextOff);

代码示例来源:origin: chrisk44/Hijacker

@Override
  public void run(){
    MDKFragment.bf_switch.setChecked(false);
  }
});

代码示例来源:origin: chrisk44/Hijacker

@Override
  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked){
    bf_switch.setChecked(false);
  }
};

代码示例来源:origin: chrisk44/Hijacker

@Override
  public void run(){
    MDKFragment.ados_switch.setChecked(false);
  }
});

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

public void ParentLayoutClicked(View _v){

  Switch _Switch_Internet = (Switch) findViewById(R.id.m_switch_internet);

    if(_Switch_Internet.isChecked()){
      _Switch_Internet.setChecked(false);         
    }
    else{
      _Switch_Internet.setChecked(true);  
  }       
}

代码示例来源:origin: julian-klode/dns66

@Override
  public void onClick(View view) {
    holder.whitelistSwitch.setChecked(!holder.whitelistSwitch.isChecked());
  }
});

代码示例来源:origin: jakob-grabner/Circle-Progress-View

@Override
  public void onStopTrackingTouch(SeekBar seekBar) {
    mCircleView.setValueAnimated(seekBar.getProgress(), 1500);
    mSwitchSpin.setChecked(false);
  }
}

代码示例来源:origin: willowtreeapps/Hyperion-Android

@Override
public void bind(String preferenceKey, Boolean preferenceValue) {
  super.bind(preferenceKey, preferenceValue);
  switchValue.setChecked(preferenceValue);
}

代码示例来源:origin: willowtreeapps/Hyperion-Android

@Override
void onDataChanged(MutableBooleanViewAttribute data) {
  keyText.setText(data.getKey());
  booleanSwitch.setChecked(data.getBoolean());
}

代码示例来源:origin: palaima/DebugDrawer

@Override
public void onResume() {
  super.onResume();
  enabledSwitch.setChecked(networkQualityConfig.networkEnabled());
  delaySeekBar.setProgress(DELAY_VALUES.indexOf(networkQualityConfig.delayMs()));
  errorSeekBar.setProgress(ERROR_VALUES.indexOf(networkQualityConfig.errorPercentage()));
}

代码示例来源:origin: eclipse/paho.mqtt.android

private void changeConnectedState(boolean state){
  mTabHost.getTabWidget().getChildTabViewAt(1).setEnabled(state);
  mTabHost.getTabWidget().getChildTabViewAt(2).setEnabled(state);
  connectSwitch.setChecked(state);
}

代码示例来源:origin: palaima/DebugDrawer

@Override
public void onStart() {
  final boolean isChecked = readValue();
  switchButton.setOnCheckedChangeListener(null);
  switchButton.setChecked(isChecked);
  switchButton.setOnCheckedChangeListener(switchListener);
  if (shouldEmitFirstValue && listener != null) {
    listener.onCheckedChanged(isChecked);
  }
}

相关文章