Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.ProgressBar;
public class ColoredProgressBar extends ProgressBar {
public ColoredProgressBar(Context context) {
super(context);
if (!isInEditMode())
init();
}
public ColoredProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
if (!isInEditMode())
init();
}
public ColoredProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
if (!isInEditMode())
init();
}
/**
* Changes color.
*/
private void init() {
getIndeterminateDrawable().setColorFilter(Color.BLUE, android.graphics.PorterDuff.Mode.MULTIPLY);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.