# 自定义仿扣扣水加载动画

public class WaterDropLoadingView extends View {

//画笔
private Paint mPaint;

private Path mPath, trianglePath1, trianglePath2;
//屏幕宽高 密度dpi
private float sWidth, sHeight, sDensityDpi;
//下面圆的半径 和 进度三角形边长
//进度弧形的其实角度和旋转角度
private float startAngle, sweepAngle;
//圆的圆点坐标
private float pointerX, pointerY;
//上部分的三角形三个顶点坐标  1 顶  2 左 3 右
private float mTriangleX1, mTriangleX2, mTriangleX3, mTriangleY1, mTriangleY2, mTriangleY3;
//控制三角形进度的高度值
private float triangleHeight;
//进度弧形的外切矩形
private RectF progressRectF;

this(context, null);
}

this(context, attrs, 0);
}

super(context, attrs, defStyleAttr);

//关闭硬件加速
setLayerType(LAYER_TYPE_SOFTWARE, null);

//设备宽高和dpi密度
DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
sWidth = displayMetrics.widthPixels;
sHeight = displayMetrics.heightPixels;
//320为我的测试机dpi密度，以次绘制视图
sDensityDpi = displayMetrics.densityDpi / 320;

//圆心坐标赋值
pointerX = pointerY = Math.min(sWidth, sHeight) / 2;
//半径和三角形边长赋值
//赋值顶点坐标
mTriangleX1 = pointerX;
mTriangleY1 = (float) (pointerY - 1.5 * mRaduis * Math.sin(Math.PI / 3));
mTriangleX2 = (float) (pointerX - mRaduis * Math.cos(Math.PI / 3));
mTriangleX3 = (float) (pointerX + mRaduis * Math.cos(Math.PI / 3));
mTriangleY2 = mTriangleY3 = (float) (pointerY - mRaduis * Math.sin(Math.PI / 3));

//初始化画笔 去锯齿
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
//初始化
mPath = new Path();
trianglePath1 = new Path();
trianglePath2 = new Path();
// 初始化速度范围的2个扇形外切矩形
progressRectF = new RectF(pointerX - mRaduis + 8 * sDensityDpi, pointerY - mRaduis + 8 * sDensityDpi,
pointerX + mRaduis - 8 * sDensityDpi, pointerY + mRaduis - 8 * sDensityDpi);
//初始化起始角度
startAngle = 90;

//计算进度三角形边长
//        triangleR = (float) (8 * Math.sqrt(3) / 3);
triangleR = mRaduis - 8 * sDensityDpi;
Log.e("triangleR===", triangleR + "");

}

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

canvas.drawColor(Color.WHITE);

//设置画笔颜色和样式
mPaint.setColor(0xFFDEE0DD);
mPaint.setStyle(Paint.Style.FILL);
//绘制圆
//绘制顶部三角形
mPath.moveTo(mTriangleX1, mTriangleY1);
mPath.lineTo(mTriangleX2, mTriangleY2);
mPath.lineTo(mTriangleX3, mTriangleY3);
//lineto起点
mPath.close();
canvas.drawPath(mPath, mPaint);

//修改画笔颜色
mPaint.setColor(0xFF13B5E8);
startAngle -= 5;
sweepAngle += 10;

if (sweepAngle < 310) {
canvas.drawArc(progressRectF, startAngle, sweepAngle, false, mPaint);
//100毫秒后重绘
postInvalidateDelayed(100);
} else {
canvas.drawArc(progressRectF, -90, 360, false, mPaint);

trianglePath1.moveTo(mTriangleX1, (float) (mTriangleY1 + mRaduis * Math.sin(Math.PI / 3) /3 ));
trianglePath1.lineTo(mTriangleX2 + 2 * (mRaduis / 2 - triangleR / 2), mTriangleY2 + mRaduis / 2 - triangleR / 2);
trianglePath1.lineTo(mTriangleX3 - 2 * (mRaduis / 2 - triangleR / 2), mTriangleY3 + mRaduis / 2 - triangleR / 2);
trianglePath1.close();
canvas.drawPath(trianglePath1, mPaint);

startAngle = 90;
sweepAngle = 0;
triangleHeight = 0;
//500毫秒后重绘
postInvalidateDelayed(500);
}

}
}


sdk manager更新失败怎么解决？

1.启动 Android SDK Manager ；
2.打开主界面，依次选择「Tools」、「Options...」，弹出『Android SDK Manager - Settings』窗口；
3.在『Android SDK Manager - Settings』窗口中，在「HTTP Proxy Server」和「HTTP Proxy Port」输入框内填入mirrors.neusoft.edu.cn和80，并且选中「Force https://... sources to be fetched using http://...」复选框；4.设置完成后单击「Close」按钮关闭『Android SDK Manager - Settings』窗口返回到主界面；

#### 自定义 仿扣扣水加载动画

2017年01月02日 21.49MB 下载

2016-12-05 22:13:04

#### Android自定义view-高仿小米视频加载动画效果

2017-07-19 20:52:36

#### 自定义动画（仿Win10加载动画）——优化

2016-10-08 16:05:29

#### 仿美团加载动画效果

2015-11-20 23:06:15

#### 自定义动画（仿Win10加载动画）

2016-10-07 17:04:19

#### android 动画--帧动画--仿美团加载中小人

2015-09-07 10:30:00

2016-05-05 11:14:31

#### 仿京东顶部加载动画

2015-11-21 14:35:49