仿京东商城下拉刷新RefreshListView,下拉的时候小人跑步加载效果,
本项目来自:https://github.com/nugongshou110/JingDongRefreshListView
主要由以下代码绘画的:
/**
* 绘制方法
* @param canvas
*/
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//因为包裹和快递小哥要分别来画,因此使用save和restore方法
//save
//画包裹
//restore
//save
//画小哥
//restore
canvas.save();
canvas.scale(mCurrentProgress, mCurrentProgress , measuredWidth-scaledGoods.getWidth()/2 , measuredHeight/2);
mPaint.setAlpha(mCurrentAlpha);
canvas.drawBitmap(scaledGoods, measuredWidth-scaledGoods.getWidth(), measuredHeight/2-scaledGoods.getHeight()/2, mPaint);
canvas.restore();
canvas.save();
canvas.scale(mCurrentProgress, mCurrentProgress , 0 , measuredHeight/2);
mPaint.setAlpha(mCurrentAlpha);
canvas.drawBitmap(scaledPeople, 0,0,mPaint);
canvas.restore();
}git
项目来源《IT蓝豹》:www.itlanbao.com
github