Android 水波风格圆形进度条
代码说明:
Android制作水波动画效果的圆形进度条,下面是相关的定义代码: private Paint mPaint; //绘制波形 private Paint mCirclePaint; //绘制圆形 private Path mPath; //记录波形的路径 private int width; //自定义view的宽度 private int height; //自定义view的高度 private int mCirclePaintRadius; //绘制圆形的半径 private int mStepSize; //绘制波形的完整周期的宽度 private int mMoveStartX; //绘制波形的初始位置,相当于震动的频率 private int mSinMax; //绘制波形的振幅 private int count = 3; //需要绘制完整波形的个数,个数越多,波形的周期越小 private Canvas mCircleCanvas; private Bitmap mDest; private int mCurrentProgress; //当前的进度 private boolean shouldChange; //用于控制正弦线的上升和下降 private Paint mTextPaint; super.onDraw(canvas); //线绘制一个实心圆 mCircleCanvas.drawCircle(width / 2, height / 2, mCirclePaintRadius, mCirclePaint); //每次绘制记得调用reset()方法,否则当前绘制会和上次的绘制重叠 mPath.reset(); //下面的moveTo,lineTo,lineTo,lineTo主要是让当前正弦线的首位相接
下载说明:请别用迅雷下载,失败请重下,重下不扣分!