I can not figure out how to implement a cyclical scrolling scale. I draw it in customview:
public void onDraw(Canvas canvas){ startingPoint = mainPoint; counter = 0; for (int i = 1;; i++) { if (startingPoint > screenSize) { break; } if(i % 4 == 0) { size = scaleHeight / 4; counter = counter + 1; } else { if(i % 2 == 0) { size = scaleHeight / 8; } else { size = scaleHeight / 16; } } canvas.drawLine(startingPoint, endPoint - size, startingPoint, endPoint, rulerPaint); if (i % 4 == 0) { String c = Integer.toString(counter); canvas.drawText(c, startingPoint, endPoint - (size + 20), textPaint); } startingPoint = startingPoint + pxmm; } I limit it to eleven long divisions: 
But I need an endless scale:
Suppose you can remove the check of the counter value in the onDraw method, but how will this affect the performance? Even if I put its value 1000, the "jerking" is already noticeable when scrolling. Here is my onScroll:
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { mainPoint = mainPoint - distanceX; invalidate(); return true; } And onMeasure:
protected void onMeasure(int w, int h) { DisplayMetrics metrics = new DisplayMetrics(); ((Activity)getContext()).getWindowManager().getDefaultDisplay().getMetrics(metrics); h = metrics.heightPixels / 5; w = metrics.widthPixels; setMeasuredDimension(w, h); scaleHeight = h; scaleWidth = w; screenSize = w; endPoint = h; midScreenPoint = w / 2; pxmm = screenSize / 28; } How are such tasks implemented?
