androidviewprogress-bar

Right to Left ProgressBar?


Does anyone know how to make a View reversed, I have a horizontal ProgressBar and I want it to right to left instead of left to right


Solution

  • Make a subclass of the normal progress bar view and implement the onDraw method to rotate the canvas before drawing it:

    @Override
    protected void onDraw(Canvas canvas) {
        canvas.save();
        canvas.rotate(180,<CenterX>,<CenterY>);
        super.onDraw(canvas);
        canvas.restore();
    }
    

    This should do the trick.