0

我尝试制作加载存储在 assest 文件中的嵌入式 html 的活动,但它没有加载任何人都可以帮助这是代码`public class Webv extends Activity{ WebView webview;

@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

     setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
     webview = new WebView(this);
     setContentView(R.layout.activity_webv);
     webview = (WebView)findViewById(R.id.wvVideos);
     webview.setWebViewClient(new WebViewClient(){
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                view.loadUrl(url);
                return false;
            }
        });

     webview.getSettings().setBuiltInZoomControls(true);
     webview.getSettings().setSupportZoom(true);
     webview.getSettings().setUseWideViewPort(true);
     webview.getSettings().setLoadWithOverviewMode(true);
     webview.getSettings().setJavaScriptEnabled(true);
     webview.getSettings().setAllowFileAccess(true);
     webview.getSettings().setAppCacheEnabled( true );
     PluginState state = WebSettings.PluginState.ON;
     webview.getSettings().setPluginState(state);
     webview.loadData("file:///android_asset/", "text/html", "utf-8");
     webview.invokeZoomPicker();
    // Toast.makeText(getApplicationContext(), getIntent().getStringExtra("address"), Toast.LENGTH_LONG).show();
     webview.loadUrl(getIntent().getStringExtra("namemovies"));
}

}

`

4

0 回答 0