Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use CircularCounter to realize the effect of double-layer prototype progress bar

Shulou Source: shulou.com Published: 2022-06-02 01:36:59 10月04日 Update

This article mainly introduces how to use CircularCounter to achieve double-layer prototype progress bar effect, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

CircularCounter double-layer prototype progress bar effect

CircularCounter double-layer prototype progress bar, which increases or decreases according to the change of data, supports reverse rotation.

This project is mainly realized by CircularCounter custom control, CircularCounter extends View

It is mainly drawn by the following code:

@ Override

Protected void onDraw (Canvas canvas) {

Super.onDraw (canvas)

Canvas.drawCircle (mBackgroundCenter, mBackgroundCenter

MBackgroundRadius, mBackgroundPaint)

Canvas.drawArc (mOneBounds, START_DEGREES, mOneDegrees, false, mOnePaint)

Canvas.drawArc (mTwoBounds, START_DEGREES, mTwoDegrees, false, mTwoPaint)

Canvas.drawArc (mThreeBounds, START_DEGREES, mThreeDegrees, false

MThreePaint)

Canvas.drawText (Integer.toString (mOneValue), mOneBounds.centerX ()

MTextPosY, mTextPaint)

Canvas.drawText (mMetricText, mOneBounds.centerX (), mMetricPosY

MMetricPaint)

}

Progress value change setting:

/ *

* Setters

*

, /

/ * *

* Set the next values to be drawn

* @ param v1

* @ param v2

* @ param v3

, /

Public void setValues (int v1, int v2, int v3) {

If (v1

Tags: Progress prototypes double layers articles effects changes support code value interests at the same time controls data more friends knowledge editing industry information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux Apple Redmi Shulou Tech Info