SwipeRefreshLayout is a circular progress map with animated effects that is applied in SwipeRefreshLayout

Only the materialDesign-style circular animation indeterminate progress indicator above API11 is supported

I usually project development necessary framework

  1. The strongest network request Net on Android
  2. The strongest list on Android (including StateLayout) BRV
  3. Android’s strongest default page StateLayout
  4. JSON and long text log printing tool LogCat
  5. Supports asynchronous and global customization of the toast tool Tooltip
  6. Develop the debugging window tool DebugKit
  7. One line of code creates the transparent StatusBar StatusBar

Set to ImageView, and then control its start and end with the start() and stop() methods

val drawable = CircularProgressDrawable(context).apply {
                strokeWidth = 10f
                strokeCap = Paint.Cap.ROUND
                centerRadius = 50f
                arrowEnabled = true
                start()
            }
findViewById<ImageView>(R.id.iv_progress).setImageDrawable(drawable)
Copy the code

Set the rounded corners

mDrawable.setStrokeCap(Paint.Cap.ROUND);
Copy the code

Set the arrow

public void	setArrowEnabled(boolean show)
// The arrow must be enabled first

public void	setArrowDimensions(float width, float height)
// Set the size of the arrow

public void	setArrowScale(float scale)
// Scale multiple on the arrow's size, invalid if no size is set
Copy the code

Set the start and end positions

public void	setStartEndTrim(float start, float end)
// Start and end angles
Copy the code
public boolean isRunning(a)
// Whether is running

public void setAlpha(int alpha)
// Set transparency

public void setBackgroundColor(int color)
// Background color

public void setCenterRadius(float centerRadius)
// Set the radius of the ring.

public void setColorFilter(ColorFilter colorFilter)

public void setColorSchemeColors(int. colors)
// Loop the color

public void setProgressRotation(float rotation)
// Number of rotations

public void setStrokeCap(Paint.Cap strokeCap)
// Set the circular node display (paint.cap. ROUND)

public void setStrokeWidth(float strokeWidth)
// Width of the ring

public void setStyle(int size)
// Set the size (LARGE and DEFAULT)

public void start(a) / /
public void stop(a) / / end
Copy the code