MCPcopy Create free account
hub / github.com/GcsSloop/AndroidNote / onDraw

Method onDraw

CustomView/Advance/Code/CheckView.java:119–138  ·  view source on GitHub ↗

绘制内容 @param canvas

(Canvas canvas)

Source from the content-addressed store, hash-verified

117 * @param canvas
118 */
119 @Override
120 protected void onDraw(Canvas canvas) {
121 super.onDraw(canvas);
122
123 // 移动坐标系到画布中央
124 canvas.translate(mWidth / 2, mHeight / 2);
125
126 // 绘制背景圆形
127 canvas.drawCircle(0, 0, 240, mPaint);
128
129 // 得出图像边长
130 int sideLength = okBitmap.getHeight();
131
132 // 得到图像选区 和 实际绘制位置
133 Rect src = new Rect(sideLength * animCurrentPage, 0, sideLength * (animCurrentPage + 1), sideLength);
134 Rect dst = new Rect(-200, -200, 200, 200);
135
136 // 绘制
137 canvas.drawBitmap(okBitmap, src, dst, null);
138 }
139
140
141 /**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected