Slide in Animation on webview data

Sandip Jadhav picture Sandip Jadhav · Oct 22, 2011 · Viewed 6.9k times · Source

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

Answer

Nick picture Nick · Aug 10, 2012

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);
    }