Question

I want to edit onDraw method for my progressbar. But in my class I use extends to Activity class. When I search on the internet I see , I should extend to ProgressBar class. But I etends activity so How can I implements ProgressBar class? my reason: I want to use progress bar which is filling right to left.

my code :

 @Override
    protected void onDraw(Canvas canvas)  {
        canvas.save();
        canvas.rotate(180,MainActivity.phone_width/2,MainActivity.phone_height/2);
        super.onDraw(canvas);
        canvas.restore();
    }
Was it helpful?

Solution

A ProgressBar is a child of View. Activity is not, but it can contain one or more ViewGroups made up of one or more Views.

Create a subclass of ProgressBar and then include it in the View that is rendered by the Activity.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top