Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Android progressBar in reverse direction.
// TODO: put package information here
import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.widget.ProgressBar;
/**
*
* Created by Prem $ on 9/29/2017.
*/
public class FlippedProgressBar extends ProgressBar {
public FlippedProgressBar(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public FlippedProgressBar(Context context, AttributeSet attrs) {
super(context, attrs);
}
public FlippedProgressBar(Context context) {
super(context);
}
@Override
protected synchronized void onDraw(Canvas canvas) {
canvas.scale(-1f, 1f, super.getWidth() * 0.5f, super.getHeight() * 0.5f);
super.onDraw(canvas);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment