android.widget.SeekBar.setThumbTintList()方法的使用及代码示例

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

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

SeekBar.setThumbTintList介绍

暂无

代码示例

代码示例来源:origin: com.albedinsky.android/ui-widget-picker

/**
 */
@Override
@SuppressLint("NewApi")
public void setThumbTintList(@Nullable ColorStateList tint) {
  if (UiConfig.MATERIALIZED) {
    super.setThumbTintList(tint);
    return;
  }
  this.ensureDecorator();
  final SeekBarTintInfo tintInfo = mDecorator.getTintInfo();
  tintInfo.tintList = tint;
  tintInfo.hasTintList = true;
  this.applyThumbTint();
}

代码示例来源:origin: com.albedinsky.android/ui

/**
 */
@Override
@SuppressLint("NewApi")
public void setThumbTintList(@Nullable ColorStateList tint) {
  if (UiConfig.MATERIALIZED) {
    super.setThumbTintList(tint);
    return;
  }
  this.ensureDecorator();
  final SeekBarTintInfo tintInfo = mDecorator.getTintInfo();
  tintInfo.tintList = tint;
  tintInfo.hasTintList = true;
  this.applyThumbTint();
}

代码示例来源:origin: garretyoder/app-theme-engine

public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) {
  final ColorStateList s1 = getDisabledColorStateList(color,
      ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light));
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    seekBar.setThumbTintList(s1);
    seekBar.setProgressTintList(s1);
  } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
    Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1);
    seekBar.setProgressDrawable(progressDrawable);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1);
      seekBar.setThumb(thumbDrawable);
    }
  } else {
    PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
      mode = PorterDuff.Mode.MULTIPLY;
    }
    if (seekBar.getIndeterminateDrawable() != null)
      seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
    if (seekBar.getProgressDrawable() != null)
      seekBar.getProgressDrawable().setColorFilter(color, mode);
  }
}

代码示例来源:origin: xuancao/DynamicSkin

public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) {
  final ColorStateList s1 = getDisabledColorStateList(color,
      ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_disabled_seekbar_dark : R.color.ate_disabled_seekbar_light));
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    seekBar.setThumbTintList(s1);
    seekBar.setProgressTintList(s1);
  } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
    Drawable progressDrawable = DrawableCompat.wrap(seekBar.getProgressDrawable());
    seekBar.setProgressDrawable(progressDrawable);
    DrawableCompat.setTintList(progressDrawable, s1);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      Drawable thumbDrawable = DrawableCompat.wrap(seekBar.getThumb());
      DrawableCompat.setTintList(thumbDrawable, s1);
      seekBar.setThumb(thumbDrawable);
    }
  } else {
    PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
      mode = PorterDuff.Mode.MULTIPLY;
    }
    if (seekBar.getIndeterminateDrawable() != null)
      seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
    if (seekBar.getProgressDrawable() != null)
      seekBar.getProgressDrawable().setColorFilter(color, mode);
  }
}

代码示例来源:origin: h4h13/RetroMusicPlayer

public static void setTint(@NonNull SeekBar seekBar, @ColorInt int color, boolean useDarker) {
  final ColorStateList s1 = getDisabledColorStateList(color, ContextCompat.getColor(seekBar.getContext(), useDarker ? R.color.ate_control_disabled_dark : R.color.ate_control_disabled_light));
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    seekBar.setThumbTintList(s1);
    seekBar.setProgressTintList(s1);
  } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
    Drawable progressDrawable = createTintedDrawable(seekBar.getProgressDrawable(), s1);
    seekBar.setProgressDrawable(progressDrawable);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
      Drawable thumbDrawable = createTintedDrawable(seekBar.getThumb(), s1);
      seekBar.setThumb(thumbDrawable);
    }
  } else {
    PorterDuff.Mode mode = PorterDuff.Mode.SRC_IN;
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
      mode = PorterDuff.Mode.MULTIPLY;
    }
    if (seekBar.getIndeterminateDrawable() != null)
      seekBar.getIndeterminateDrawable().setColorFilter(color, mode);
    if (seekBar.getProgressDrawable() != null)
      seekBar.getProgressDrawable().setColorFilter(color, mode);
  }
}

相关文章

SeekBar类方法