本文整理了Java中android.widget.SeekBar.setProgressTintList()
方法的一些代码示例,展示了SeekBar.setProgressTintList()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SeekBar.setProgressTintList()
方法的具体详情如下:
包路径:android.widget.SeekBar
类名称:SeekBar
方法名:setProgressTintList
暂无
代码示例来源:origin: com.albedinsky.android/ui
/**
*/
@Override
@SuppressLint("NewApi")
public void setProgressTintList(@Nullable ColorStateList tint) {
if (UiConfig.MATERIALIZED) {
super.setProgressTintList(tint);
return;
}
this.ensureDecorator();
final SeekBarTintInfo tintInfo = mDecorator.getTintInfo();
tintInfo.primaryProgressTintList = tint;
tintInfo.hasPrimaryProgressTintList = true;
this.applyProgressTints();
}
代码示例来源:origin: com.albedinsky.android/ui-widget-picker
/**
*/
@Override
@SuppressLint("NewApi")
public void setProgressTintList(@Nullable ColorStateList tint) {
if (UiConfig.MATERIALIZED) {
super.setProgressTintList(tint);
return;
}
this.ensureDecorator();
final SeekBarTintInfo tintInfo = mDecorator.getTintInfo();
tintInfo.primaryProgressTintList = tint;
tintInfo.hasPrimaryProgressTintList = true;
this.applyProgressTints();
}
代码示例来源:origin: ywwynm/EverythingDone
public static void setSeekBarColor(SeekBar seekBar, int color) {
if (DeviceUtil.hasLollipopApi()) {
seekBar.setProgressTintList(ColorStateList.valueOf(color));
} else {
seekBar.getProgressDrawable().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
seekBar.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
代码示例来源:origin: pranavpandey/dynamic-support
/**
* Set a hue gradient progress drawable for a seek bar.
*
* @param seekBar The seek bar to set the hue gradient.
*/
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setHueDrawable(@NonNull SeekBar seekBar) {
if (DynamicVersionUtils.isLollipop()) {
seekBar.setProgressTintList(null);
}
LinearGradient gradient =
new LinearGradient(0.0f, 0.0f, (float) seekBar.getWidth(), 0.0f,
new int[] { 0xFFFF0000, 0xFFFFFF00, 0xFF00FF00,
0xFF00FFFF, 0xFF0000FF, 0xFFFF00FF, 0xFFFF0000 },
null, Shader.TileMode.CLAMP);
ShapeDrawable shape = new ShapeDrawable(new RectShape());
shape.getPaint().setShader(gradient);
Rect bounds = seekBar.getProgressDrawable().getBounds();
bounds.inset(0, (int) (bounds.height() * 0.45f));
seekBar.setProgressDrawable(shape);
seekBar.getProgressDrawable().setBounds(bounds);
}
}
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!