Slide in Animation on webview data

7.3k views Asked by At

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

1

There are 1 answers

1
Nick On BEST ANSWER

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