从原文件夹中的Web视图加载HTML文件 [英] Load html files from raw folder in web view

查看:280
本文介绍了从原文件夹中的Web视图加载HTML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何加载HTML文件中从原材料folder.I Web视图不知道如何添加在WebView.loadData这些原始的HTML文件的路径()函数。我知道如何加载文件从Web视图中的资源文件夹,但在这里得到问题的原始文件夹。

How to load html files in web view from raw folder.I don't know how to add the path of these raw html files in WebView.loadData() function. I know how to load file from asset folder in web view but here getting problem with raw folder.

在此先感谢

推荐答案

使用这种code从原始文件夹中加载HTML文件的Web视图:

Use this code for Load html files from raw folder in web view:

有关详细信息,请参见的javadoc的WebView 的:

For more information see the javadoc for WebView:

     public class ViewWeb extends Activity {  
            @Override  
            public void onCreate(Bundle savedInstanceState) {  
                super.onCreate(savedInstanceState);
                setContentView(R.layout.webview);  

                WebView lWebView = (WebView)findViewById(R.id.webView);
                lWebView.loadUrl("file:///android_res/raw/your_file_name.html");
            }  
        }

这篇关于从原文件夹中的Web视图加载HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆