Last active
August 22, 2018 07:11
-
-
Save premacck/9344f17da8e0a25712b1395991f0c5d5 to your computer and use it in GitHub Desktop.
Android progressBar in reverse direction.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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