Make a custom progress bar in Android [closed]

Multi tool use
Multi tool use


Make a custom progress bar in Android [closed]



I need to make a custom progress bar that looks like this: enter image description here



I'd love some advice for the best way to do this.
thanks!



Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.





Please show us what you have tried so far
– Gennadii Saprykin
Jul 3 at 8:10





stackoverflow.com/questions/21333866/…
– Gowthaman M
Jul 3 at 8:16





the best way to do this is probably by typing code.
– 2Dee
Jul 3 at 8:22





what is it with everyone spreading hate? it's a fellow coder asking a question.. stop being so mean and try to help.. isn't it why this site exist?
– JozeRi
Jul 3 at 8:32





@JozeRi a fellow coder needs to code to be a coder. There is no code in this question. And no, this is not why the site exists, this ain't no free coding service. More about this in ... you guesses it, the same (very) old page everyone seems to think is not for them: the help section. Enjoy the read, it's a good one.
– 2Dee
Jul 3 at 8:44




2 Answers
2



https://github.com/lzyzsd/CircleProgress



There are already many libraries providing these type of progressbar. Check above one.


allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}



app level gradle.


dependencies {
compile 'com.github.lzyzsd:circleprogress:1.2.1'
}



In your layout


<com.github.lzyzsd.circleprogress.DonutProgress
android:layout_marginLeft="50dp"
android:id="@+id/donut_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
custom:donut_progress="30"/>



See https://github.com/lzyzsd/CircleProgress for all available customizations.


@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int x = canvas.getWidth();
int y = canvas.getHeight();

float left = x/2 ;
float top = y/2 ;
float right = x/2 ;
float bottom = y/2 ;

mRectF.left = left;
mRectF.top = top;
mRectF.right = right;
mRectF.bottom = bottom;

mPaint.setStrokeWidth(strokeWidth);
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setStyle(Paint.Style.FILL);
mPaint.setColor(Color.WHITE);



mPaint.setShader(null);
canvas.drawCircle(x/2,y/2, strokeWidth* 1.5f,mPaint);
mPaint.setStyle(Paint.Style.STROKE);


mPaint.setShader(createGradient());
canvas.drawArc(mRectF,0,360,false, mPaint);


Shader mGradient = createGradient();
mMatrix.setRotate(-90f, x / 2 , y / 2 );
mGradient.setLocalMatrix(mMatrix);
mPaint.setShader(mGradient);
canvas.drawArc(mRectF,ANGLE_START,currentAngle,false, mPaint);

}

u ubbKFI,Fy3KNySqk yR0JIOyFM5ra,iLxH21xExHf0rW4ydFv NCij
Nz3JkLmEzo2aNSjqshN91j 9iYUZ2,oFpVZm5aB02V 7uImv Z5nqKAV1,0r403cBLU

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications