本文整理了Java中android.widget.SeekBar.getProgressDrawable()
方法的一些代码示例,展示了SeekBar.getProgressDrawable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SeekBar.getProgressDrawable()
方法的具体详情如下:
包路径:android.widget.SeekBar
类名称:SeekBar
方法名:getProgressDrawable
暂无
代码示例来源:origin: naman14/Timber
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(
R.layout.fragment_timber6, container, false);
setMusicStateListener();
setSongDetails(rootView);
initGestures(rootView.findViewById(R.id.album_art));
((SeekBar) rootView.findViewById(R.id.song_progress)).getProgressDrawable().setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.MULTIPLY));
((SeekBar) rootView.findViewById(R.id.song_progress)).getThumb().setColorFilter(new PorterDuffColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP));
nextSong = (TextView) rootView.findViewById(R.id.title_next);
nextArt = (CircleImageView) rootView.findViewById(R.id.album_art_next);
rootView.findViewById(R.id.nextView).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
MusicPlayer.next();
}
});
return rootView;
}
代码示例来源:origin: TeamNewPipe/NewPipe
this.playbackSeekBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.MULTIPLY);
代码示例来源:origin: dkim0419/SoundRecorder
ColorFilter filter = new LightingColorFilter
(getResources().getColor(R.color.primary), getResources().getColor(R.color.primary));
mSeekBar.getProgressDrawable().setColorFilter(filter);
mSeekBar.getThumb().setColorFilter(filter);
代码示例来源:origin: com.albedinsky.android/ui
/**
* <b>Note, that on pre {@link android.os.Build.VERSION_CODES#LOLLIPOP LOLLIPOP} Android versions
* this method will return an instance of {@link TintLayerDrawable TintLayerDrawable} if tint has
* been applied to one of progress layers via {@link #setProgressTintList(ColorStateList)} or
* {@link #setSecondaryProgressTintList(ColorStateList)} or {@link #setProgressBackgroundTintList(ColorStateList)}.</b>
* <p>
* The original wrapped drawable can be obtained via {@link TintDrawable#getDrawable()}.
*/
@Override
public Drawable getProgressDrawable() {
return super.getProgressDrawable();
}
代码示例来源:origin: com.albedinsky.android/ui-widget-picker
/**
* <b>Note, that on pre {@link android.os.Build.VERSION_CODES#LOLLIPOP LOLLIPOP} Android versions
* this method will return an instance of {@link TintLayerDrawable TintLayerDrawable} if tint has
* been applied to one of progress layers via {@link #setProgressTintList(ColorStateList)} or
* {@link #setSecondaryProgressTintList(ColorStateList)} or {@link #setProgressBackgroundTintList(ColorStateList)}.</b>
* <p>
* The original wrapped drawable can be obtained via {@link TintDrawable#getDrawable()}.
*/
@Override
public Drawable getProgressDrawable() {
return super.getProgressDrawable();
}
代码示例来源:origin: adolfAn/FBReader_AS
public SeekBarDrawable() {
myBase = mySlider.getProgressDrawable();
myPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
myPaint.setTypeface(Typeface.DEFAULT_BOLD);
myPaint.setColor(Color.BLACK);
myPaint.setAlpha(255);
myOutlinePaint = new Paint(myPaint);
myOutlinePaint.setStyle(Paint.Style.STROKE);
myOutlinePaint.setStrokeWidth(3);
myOutlinePaint.setColor(0xFFAAAAAA);
}
代码示例来源:origin: dev-labs-bg/fullscreen-video-view
private void setupProgressBar(TypedArray a) {
int color = a.getColor(R.styleable.VideoControllerView_progress_color, 0);
if (color != 0) {
// Set the default color
progressBarColor = color;
}
progress.getProgressDrawable().setColorFilter(progressBarColor, PorterDuff.Mode.SRC_IN);
progress.getThumb().setColorFilter(progressBarColor, PorterDuff.Mode.SRC_IN);
}
代码示例来源:origin: rkkr/simple-keyboard
@Override
protected View onCreateDialogView() {
final View view = super.onCreateDialogView();
mSeekBarRed = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_red);
mSeekBarRed.setMax(255);
mSeekBarRed.setOnSeekBarChangeListener(this);
mSeekBarRed.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
mSeekBarRed.getThumb().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
mSeekBarGreen = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_green);
mSeekBarGreen.setMax(255);
mSeekBarGreen.setOnSeekBarChangeListener(this);
mSeekBarGreen.getThumb().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
mSeekBarGreen.getProgressDrawable().setColorFilter(Color.GREEN, PorterDuff.Mode.SRC_IN);
mSeekBarBlue = (SeekBar)view.findViewById(R.id.seek_bar_dialog_bar_blue);
mSeekBarBlue.setMax(255);
mSeekBarBlue.setOnSeekBarChangeListener(this);
mSeekBarBlue.getThumb().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN);
mSeekBarBlue.getProgressDrawable().setColorFilter(Color.BLUE, PorterDuff.Mode.SRC_IN);
mValueView = (TextView)view.findViewById(R.id.seek_bar_dialog_value);
return view;
}
代码示例来源:origin: yuyangXu0222/eBook
private void setCurSeekBarStyle() {
for (SeekBar seekBar : mSeekBars) {
//获取seekBar的layer-list drawable对象
LayerDrawable layerDrawable = (LayerDrawable) seekBar.getProgressDrawable();
//层次包括背景图和进度,所以进度直接设为1,获取并设置进度条背景
Drawable drawable = layerDrawable.getDrawable(1);
drawable.setColorFilter(mStrokeColors[mTheme], PorterDuff.Mode.SRC);
//获取thumb背景
Drawable thumb = seekBar.getThumb();
thumb.setColorFilter(mStrokeColors[mTheme], PorterDuff.Mode.SRC);
}
}
代码示例来源:origin: antonKozyriatskyi/CircularProgressIndicator
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
int redProgress = red.getProgress();
int greenProgress = green.getProgress();
int blueProgress = blue.getProgress();
colorResult.setBackgroundColor(Color.rgb(redProgress, greenProgress, blueProgress));
switch (seekBar.getId()) {
case R.id.sb_red:
seekBar.getProgressDrawable().setColorFilter(Color.rgb(redProgress, 0, 0), mode);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
seekBar.getThumb().setColorFilter(Color.rgb(redProgress, 0, 0), mode);
}
break;
case R.id.sb_green:
seekBar.getProgressDrawable().setColorFilter(Color.rgb(0, greenProgress, 0), mode);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
seekBar.getThumb().setColorFilter(Color.rgb(0, greenProgress, 0), mode);
}
break;
case R.id.sb_blue:
seekBar.getProgressDrawable().setColorFilter(Color.rgb(0, 0, blueProgress), mode);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
seekBar.getThumb().setColorFilter(Color.rgb(0, 0, blueProgress), mode);
}
break;
}
}
};
代码示例来源: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: antonKozyriatskyi/CircularProgressIndicator
red.getProgressDrawable().setColorFilter(Color.rgb(red.getProgress(), 0, 0), mode);
green.getProgressDrawable().setColorFilter(Color.rgb(0, green.getProgress(), 0), mode);
blue.getProgressDrawable().setColorFilter(Color.rgb(0, 0, blue.getProgress()), mode);
代码示例来源:origin: qiushi123/VideoDemoQcl
private void setSkin(Skin skin) {
Resources resource = getContext().getResources();
if (skin.titleColor != 0) {
ColorStateList titleCsl = resource.getColorStateList(skin.titleColor);
if (titleCsl != null) {
tvTitle.setTextColor(titleCsl);
}
}
if (skin.timeColor != 0) {
ColorStateList timeCsl = resource.getColorStateList(skin.timeColor);
if (timeCsl != null) {
tvTimeCurrent.setTextColor(timeCsl);
tvTimeTotal.setTextColor(timeCsl);
}
}
if (skin.seekDrawable != 0) {
Drawable bg = resource.getDrawable(skin.seekDrawable);
Rect bounds = skProgress.getProgressDrawable().getBounds();
skProgress.setProgressDrawable(bg);
skProgress.getProgressDrawable().setBounds(bounds);
pbBottom.setProgressDrawable(resource.getDrawable(skin.seekDrawable));
}
if (skin.bottomControlBackground != 0) {
llBottomControl.setBackgroundColor(resource.getColor(skin.bottomControlBackground));
}
this.enlargRecId = skin.enlargRecId;
this.shrinkRecId = skin.shrinkRecId;
}
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_from_file);
button = findViewById(R.id.b_start_stop);
bSelectFile = findViewById(R.id.b_select_file);
button.setOnClickListener(this);
bSelectFile.setOnClickListener(this);
bReSync = findViewById(R.id.b_re_sync);
bReSync.setOnClickListener(this);
bRecord = findViewById(R.id.b_record);
bRecord.setOnClickListener(this);
etUrl = findViewById(R.id.et_rtp_url);
etUrl.setHint(R.string.hint_rtmp);
seekBar = findViewById(R.id.seek_bar);
seekBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
tvFile = findViewById(R.id.tv_file);
rtmpFromFile = new RtmpFromFile(this, this, this);
seekBar.setOnSeekBarChangeListener(this);
}
代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_from_file);
button = findViewById(R.id.b_start_stop);
bSelectFile = findViewById(R.id.b_select_file);
button.setOnClickListener(this);
bSelectFile.setOnClickListener(this);
bReSync = findViewById(R.id.b_re_sync);
bReSync.setOnClickListener(this);
bRecord = findViewById(R.id.b_record);
bRecord.setOnClickListener(this);
etUrl = findViewById(R.id.et_rtp_url);
etUrl.setHint(R.string.hint_rtsp);
seekBar = findViewById(R.id.seek_bar);
seekBar.getProgressDrawable().setColorFilter(Color.RED, PorterDuff.Mode.SRC_IN);
seekBar.setOnSeekBarChangeListener(this);
tvFile = findViewById(R.id.tv_file);
rtspFromFile = new RtspFromFile(this, this, this);
}
代码示例来源: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: 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: 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);
}
}
代码示例来源:origin: dev-labs-bg/fullscreen-video-view
progress.getProgressDrawable().setColorFilter(progressBarColor, PorterDuff.Mode.SRC_IN);
progress.getThumb().setColorFilter(progressBarColor, PorterDuff.Mode.SRC_IN);
progress.setOnSeekBarChangeListener(seekListener);
内容来源于网络,如有侵权,请联系作者删除!