AnderWeb / AnderWeb/discreteSeekBar

partially fill background of progress

Ouverte
#76 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Java
Étoiles
2.1k
Forks
417
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

I need to partially fill progress background using a PartialDrawable class. However, `setProgressDrawable` is not available in discrete seek bar. Can you help me how to partially draw the background of progress bar?
PartialDrawable class is the following;

``` java
public class PartialDrawable extends Drawable {

private float mStart;
private float mEnd;
private Paint mPaint;

List> mPairs;

public PartialDrawable(List> parts) {
mPairs = parts;
mPaint = new Paint();
}

@Override
public void draw(Canvas canvas) {
for (int i = 0; i < mPairs.size(); i++) {

float start = mPairs.get(i).first;
float end = mPairs.get(i).second;

Rect b = getBounds();
mPaint.setColor(Color.RED);
canvas.drawRect(b, mPaint);
mPaint.setColor(Color.RED);
canvas.drawRect(b.width() * start, b.top, b.width() * end, b.bottom, mPaint);
}
}

@Override
public void setAlpha(int alpha) {
}

@Override
public void setColorFilter(ColorFilter cf) {
}

@Override
public int getOpacity() {
return PixelFormat.TRANSLUCENT;
}
}

```

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.