1

I am showing a description like data which I am showing in webview & when uesr click on next I am changing webview data now I want to show some kind of slide in animation while changing webview's data can anyone suggest me how I can set animation to a single webview??

Thank You

Sandip Jadhav
  • 7,377
  • 8
  • 44
  • 76

1 Answers1

5

I used this post to have the webpage slide in and out. The code is used for a custom webview client.

 private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.setVisibility(View.GONE);
            mProgressDialog.setTitle("Loading");
            mProgressDialog.show();
            mProgressDialog.setMessage("Loading " + url);
            return false;
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            mProgressDialog.dismiss();
            animate(view);
            view.setVisibility(View.VISIBLE);
            super.onPageFinished(view, url);
        }
    }

    private void animate(final WebView view) {
        Animation anim = AnimationUtils.loadAnimation(getBaseContext(),
                android.R.anim.slide_in_left);
        view.startAnimation(anim);
    }
Community
  • 1
  • 1
Nick
  • 9,285
  • 33
  • 104
  • 147