material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[Slider] Customize Tick for Discrete Slider

Open arctouch-carlosottoboni opened this issue 5 years ago • 6 comments
trafficstars

Is your feature request related to a problem? Please describe. I want the ability to customize the Tick drawable for my Slider, by sending the desired drawable asset

Describe the solution you'd like Instead of drawing only the default tick, I want to set a custom drawable shape to be used

Describe alternatives you've considered Currently, I didn't see any alternative to have this asset customizable.

arctouch-carlosottoboni avatar May 25 '20 17:05 arctouch-carlosottoboni

Duplicate https://github.com/material-components/material-components-android/issues/935

ymarian avatar May 27 '20 19:05 ymarian

@ymarian This is not related to the #935 that requests to change the Thumb Drawable, what I want is to change the Tick drawable for the Discrete Slider, that currently it's been drawing programmatically by this method:

private void drawTicks(@NonNull Canvas canvas) {
    float[] activeRange = getActiveRange();
    int leftPivotIndex = pivotIndex(ticksCoordinates, activeRange[0]);
    int rightPivotIndex = pivotIndex(ticksCoordinates, activeRange[1]);

    // Draw inactive ticks to the left of the smallest thumb.
    canvas.drawPoints(ticksCoordinates, 0, leftPivotIndex * 2, inactiveTicksPaint);

    // Draw active ticks between the thumbs.
    canvas.drawPoints(
        ticksCoordinates,
        leftPivotIndex * 2,
        rightPivotIndex * 2 - leftPivotIndex * 2,
        activeTicksPaint);

    // Draw inactive ticks to the right of the largest thumb.
    canvas.drawPoints(
        ticksCoordinates,
        rightPivotIndex * 2,
        ticksCoordinates.length - rightPivotIndex * 2,
        inactiveTicksPaint);
  }

arctouch-carlosottoboni avatar May 27 '20 19:05 arctouch-carlosottoboni

Any info on this? Is it being considered or is there no plan on supporting this?

OndrejPolak avatar Jul 30 '21 13:07 OndrejPolak

Any update on this?

chintanrparmar avatar Apr 11 '22 11:04 chintanrparmar

Any update on this? + 2

Nanamare avatar Jan 09 '24 15:01 Nanamare