Android: WebView Scroll Animation -
I'm implementing an app that contains some content to show in the webview so far I have been using the object animator I am getting smooth animation of scrolling webview content.
The problem I am facing now is that it is working fine for the first and second pages and scrolls are demanded but when I want to scroll to the third page, So I think that it is starting scrolling from the first page, then the other goes, and then in the third place, I want that I do not want to do that webview should maintain its scroll position and Must scroll Tman
if (incre & lt; = total pages) {incre ++;
TotalNumberofPages = totalNumberofPages + incre; // view.loadUrl ("JavaScript: PagesSolol (" // + incre * view.getWitth (+ + ")"); ObjectAnimator anim = ObjectAnimator.ofInt (see, "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 Animation repeat animation (Animation Animation) {// TODO Auto-Generated Method Stub} @ Override Public Zero on AnimationAnd (Animator Animation) {/ TODO Automatically Generated Method Stub // Visual Ascalto (0, IQWin * ViewGetWidth); Scroll scrollTo (incre * view.getWidth (), 0); ReaderActivity .txt_numberofpages_left .setText ("Page:" + + + "+ +" of total pages + + + +); ReaderActivity.tx T_leftPage.setText ("+" + Total number of pages); ReaderActivity.txt_RightPage.setText ("+ + (total number of page + 1 +)";} @ Override public blank on animation console (animator animation) ) {/ TODO auto-generated method stub}});
This is happening due to this line of code
Object Animator Animation = Object Animator. OFIN (see, "ScrollX", 0, Irvic * View.Gate Wideth ()); Anim.setDuration (4000); Anim.start ();
After ScrollX, you are sending hardcod 0 which will scroll your content from start to position, maintain the last position and pass this state instead of this place.
Comments
Post a Comment