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

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

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

Switch.setTextColor介绍

暂无

代码示例

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

protected void onCreate(Bundle savedInstanceState) 
{
  super.onCreate(savedInstanceState);
  setContentView(R.layout.toggle_button);

  Switch sw = (Switch) findViewById(R.id.switch1);

      //Both of these need to be used to change the text color to white
      sw.setTextColor(Color.WHITE);
  sw.setSwitchTextAppearance(this, Color.WHITE);

      //Doing this would skew the circle
      //sw.setTextOn("  ");
  //sw.setTextOff("   ");
}

代码示例来源:origin: EthACKdotOrg/orWall

if (this.browser_uid != 0  && Preferences.isOrwallEnabled(getActivity())) {
  browserStatus.setClickable(true);
  browserStatus.setTextColor(Color.BLACK);
  browserStatus.setTextColor(Color.GRAY);
if (this.sip_uid != 0  && Preferences.isOrwallEnabled(getActivity())) {
  sipStatus.setClickable(false);
  sipStatus.setTextColor(Color.BLACK);
  sipStatus.setTextColor(Color.GRAY);

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

private void applyLogTypeSwitches(LinearLayout layout) {
    LogType[] logTypes = Logger.LogType.values();
    final float scale = getContext().getResources().getDisplayMetrics().density;
    HashSet<String> activeTypes = Logger.getActiveLogTypes();

    for (LogType logType : logTypes) {
      Switch logSwitch = new Switch(layout.getContext());
      int pad = (int) (10f * scale);
      logSwitch.setPadding(pad, pad / 2, pad, pad / 2);
      logSwitch.setText(logType.name());
      logSwitch.setChecked(activeTypes.contains(logType.name()));
      logSwitch.setTextSize(7f * scale);
      logSwitch.setTextColor(Color.GRAY);
      logSwitch.setTag(logType.name());

      logSwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton compoundButton, boolean state) {
          String tag = (String) compoundButton.getTag();
          Logger.setLogTypeState(tag, state);
        }
      });

      layout.addView(logSwitch);
    }
  }
}

代码示例来源:origin: Odoo-mobile/framework

mSwitch.setTextAppearance(mContext, appearance);
mSwitch.setTextColor(textColor);
addView(mSwitch);
break;

相关文章