小编ale*_*g86的帖子

如何在Web视图中使用android过渡效果?

如果有人能帮助我,我将非常高兴.我有一个使用webview的应用程序.webview加载了一个网址,我使用Google教程覆盖了我想用webview打开的所有其他链接.我已经创建了一个animimation文件,res/并且slide_right xml到目前为止一直很好.我在主java活动中调用了效果,但它仅适用于第一页.我想要的是在webview中链接加载的每个页面中应用的效果.

你能用我的代码帮助我吗?

package com.ihome;

import android.app.Activity;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;



public class IhomeActivity extends Activity {
    WebView mWebView;
    private class HelloWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            Animation slideRightAnimation = AnimationUtils.loadAnimation(getBaseContext (), R.anim.slide_right);
            mWebView.startAnimation(slideRightAnimation);
            view.loadUrl(url);
            return true;
        }
    }


@Override
    public boolean onKeyDown(int keyCode, …
Run Code Online (Sandbox Code Playgroud)

android android-animation android-webview

10
推荐指数
1
解决办法
2万
查看次数