title: Android OverScroller and performance
body: <p>I have used <a href="http://developer.android.com/reference/android/widget/OverScroller.html" rel="nofollow">OverScroller</a> for implementing scroll of my view. </p>
  
  <p>Here is some code:</p>
  
  <pre><code>@Override
  protected void onDraw(Canvas canvas) {
      if (scroller.computeScrollOffset()){
          int x = scroller.getCurrX();
          int y = scroller.getCurrY();
          scrollTo(x, y);
  
          ViewCompat.postInvalidateOnAnimation(this);
      }
  
      super.onDraw(canvas);
  }
  
  public void open(){
      scroller.startScroll(0, 0, 0, -mContent.getMeasuredHeight(), ANIMATION_TIME);
      invalidate();
  }
  
  public void close(){
      scroller.startScroll(0, getScrollY(), 0, mContent.getMeasuredHeight(), ANIMATION_TIME);
      invalidate();
  }
  </code></pre>
  
  <p>It works fine. But on device with Full HD screen (Sony xperia Z) the method onDraw calls 4 times. On "Samsung Galaxy Note 2" it calls about 10 times. Hence on xperia i see lags. What can i do to improve performance ?</p>
  
  <p><strong>UPD:</strong> Here is full code <a href="http://xsnippet.org/359714" rel="nofollow">http://xsnippet.org/359714</a> </p>