问题描述
Pointp=newPoint(OFFSET_LEFT+WIDTH,py[k]);if(point1.size()>81){point1.remove(0);//0为数组索引,此位图中最多存21个数据,如果大于21个数据就得把最头上的删除,然后重新给数组制定索引for(inti=0;i<80;i++){if(i==0){point1.get(i).x-=(X_INTERVAL-0.2);}else{point1.get(i).x-=X_INTERVAL;}j+=X_INTERVAL;}point1.add(p);}else{for(inti=0;i<point1.size()-1;i++){point1.get(i).x-=X_INTERVAL;j+=X_INTERVAL;}point1.add(p);}if(point1.size()>=2){for(inti=0;i<point1.size()-1;i++){Paintpaint=newPaint();paint.setColor(Color.WHITE);paint.setStrokeWidth(3);paint.setAntiAlias(true);Canvascanvas=holder.lockCanvas(newRect(point1.size()*X_INTERVAL,50,WIDTH+OFFSET_LEFT,HEIGHT));canvas.drawLine(point1.get(i).x,point1.get(i).y,point1.get(i+1).x,point1.get(i+1).y,paint);holder.unlockCanvasAndPost(canvas);//解锁画布}}}//canvas.drawLines(line,paint);