protected void onDraw(Canvas canvas) { super.onDraw(canvas); /* * 要六行,七列 */ int length = width / 7 + 1;// 横长 int bound = height / 6;// 竖长 for (int i = 0; i < bound; i++) { for (int j = 0; j < length; j++) { /* * 画竖线 */ canvas.drawLine(j * length, 0, j * length, height, mPaint); /* * 画横线 */ canvas.drawLine(0, i * bound, width, i * bound, mPaint); } } }