在屏幕中绘制xy轴刻度便于参考
public static void drawMark(Canvas canvas){ paint.setColor(Color.BLUE); paint.setStyle(Paint.Style.STROKE); paint.setAntiAlias(true);//去锯齿 paint.setTextSize(20); // x 轴 //canvas.drawLine(0, 0, 800*3/2, 0, paint); // x 轴刻度 每个刻度100 for(int i=0; i<14; i++){ canvas.drawLine(100*i, 0, 100*i, 15, paint); canvas.drawText(""+i, 100*i, 20, paint); } // y 轴 //canvas.drawLine(5, 5, 800*3/2, 5, paint); // y 轴刻度 for(int i=0; i<8; i++){ canvas.drawLine(0, 100*i, 15, 100*i, paint); canvas.drawText(""+i, 5, 100*i+10, paint); }}