title: Android: WebView Scroll Animation
body: <p>i am implementing an app which has some contents to show in webview. 
  i am so far achieved smooth animation of scrolling webview contents using the object Animator.</p>
  
  <p>Now what issue i am facing is that it is working fine for first and second page and scrolls as demand. but when i want to scroll on 3rd page what issue i have is that it starts scrolling from first page then moving to second and then to third i dont want this to happen i want is that webview should maintain its scroll position and scroll from the current position.</p>
  
  <p>here is my code so far to make the webview contents scroll using objectanimator.</p>
  
  <pre><code>            if (incre &lt;= totalPages) {
                      incre++;
                      totalNumberofPages = totalNumberofPages + incre;
                      // view.loadUrl("javascript:pageScroll("
                      // + incre * view.getWidth() + ")");
  
                      ObjectAnimator anim = ObjectAnimator.ofInt(view,
                              "scrollX", 0, incre * view.getWidth());
                      anim.setDuration(4000);
                      anim.start();
  
                      // view.scrollTo(incre*view.getWidth(), 0);
  
                      anim.addListener(new AnimatorListener() {
  
                          @Override
                          public void onAnimationStart(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
  
                          @Override
                          public void onAnimationRepeat(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
  
                          @Override
                          public void onAnimationEnd(Animator animation) {
                              // TODO Auto-generated method stub
                              // view.scrollTo(0, incre*view.getWidth());
  
                              view.scrollTo(incre * view.getWidth(), 0);
                              ReaderActivity.txt_numberofpages_left
                                      .setText("Page:  " + incre + " of "
                                              + totalPages);
                              ReaderActivity.txt_leftPage.setText(""
                                      + totalNumberofPages);
                              ReaderActivity.txt_RightPage.setText(""
                                      + (totalNumberofPages + 1));
                          }
  
                          @Override
                          public void onAnimationCancel(Animator animation) {
                              // TODO Auto-generated method stub
  
                          }
                      });
  </code></pre>