@@ -293,11 +293,10 @@ public Slider(@NonNull Context context, @Nullable AttributeSet attrs, int defSty
293293 activeTicksPaint .setStrokeWidth (trackHeight / 2.0f );
294294 activeTicksPaint .setStrokeCap (Cap .ROUND );
295295
296- Drawable background = getBackground ();
297296 if (VERSION .SDK_INT >= VERSION_CODES .LOLLIPOP ) {
297+ Drawable background = getBackground ();
298298 if (background instanceof RippleDrawable ) {
299299 ((RippleDrawable ) background ).setColor (haloColor );
300- DrawableUtils .setRippleDrawableRadius (background , haloRadius );
301300 }
302301 // Because the RippleDrawable can draw outside the bounds of the view, we can set the layer
303302 // type to hardware so we can use PorterDuffXfermode when drawing.
@@ -361,7 +360,7 @@ private void processAttributes(Context context, AttributeSet attrs, int defStyle
361360 label = parseLabelDrawable (context , a );
362361
363362 setThumbRadius (a .getDimensionPixelSize (R .styleable .Slider_thumbRadius , 0 ));
364- haloRadius = a .getDimensionPixelSize (R .styleable .Slider_haloRadius , 0 );
363+ setHaloRadius ( a .getDimensionPixelSize (R .styleable .Slider_haloRadius , 0 ) );
365364
366365 setThumbElevation (a .getDimension (R .styleable .Slider_thumbElevation , 0 ));
367366
@@ -673,6 +672,12 @@ public int getHaloRadius() {
673672 */
674673 public void setHaloRadius (@ IntRange (from = 0 ) @ Dimension int radius ) {
675674 haloRadius = radius ;
675+ if (VERSION .SDK_INT >= VERSION_CODES .LOLLIPOP ) {
676+ Drawable background = getBackground ();
677+ if (background instanceof RippleDrawable ) {
678+ DrawableUtils .setRippleDrawableRadius ((RippleDrawable ) background , haloRadius );
679+ }
680+ }
676681 postInvalidate ();
677682 }
678683
0 commit comments