当前位置:   article > 正文

自定义圆形、半圆形ProgressBar_u-circle-progress 半圆

u-circle-progress 半圆

最近在做的项目中遇到做圆形、半圆形ProgressBar,先分享给大家
主要用到类:
一、Android RectF类的构造函数参数说明
以下是API中的说明:
public RectF (float left, float top, float right, float bottom)

Added in API level 1
Create a new rectangle with the specified coordinates. Note: no range checking is performed, so the caller must ensure that left <= right and top <= bottom.

Parameters
left The X coordinate of the left side of the rectangle
top The Y coordinate of the top of the rectangle
right The X coordinate of the right side of the rectangle
bottom The Y coordinate of the bottom of the rectangle
比如new一个RecF类:
RectF rf1 = new RectF(100,100,200,200);
则在屏幕中的位置示意图为:

二、SweepGradient的说明与使用
主要实现圆形可颜色渐变进度条

public SweepGradient(float cx, float cy, int[] colors, float[] positions)
Parameters:

cx 渲染中心点x 坐标
cy 渲染中心y 点坐标
colors 围绕中心渲染的颜色数组,至少要有两种颜色值
positions 相对位置的颜色数组,可为null, 若为null,可为null,颜色沿渐变线均匀分布

public SweepGradient(float cx, float cy, int color0, int color1)
Parameters:

cx 渲染中心点x 坐标
cy 渲染中心点y 坐标
color0 起始渲染颜色
color1 结束渲染颜色

三、Canvas
public void draw

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/474157
推荐阅读
相关标签
  

闽ICP备14008679号