是什么文件:///android_asset/www/index.html是什么意思? [英] What does file:///android_asset/www/index.html mean?
问题描述
我想知道什么呢文件:///
的意思是在加载从资产的文件夹中的android一个HTML文件
I want to know what does file:///
mean while loading a html file from the assets folder in android
它是指向根目录的绝对路径名?
Is it an absolute path name which points to the root directory?
我顺便教程PhoneGap的看到这个。
I saw this in the tutorial for phonegap by the way.
推荐答案
文件:///
是一个URI(统一资源标识符),简单地从标准的URI区分我们都知道的非常清楚 - 的http://
file:///
is a URI (Uniform Resource Identifier) that simply distinguishes from the standard URI that we all know of too well - http://
.
它确实意味着一个绝对路径指向在任何环境下的根目录,但在Android的背景下,这是一个约定,告诉了Android运行时间说的在这里,目录 WWW
有一个名为 index.html的
位于资产
文件夹中根项目的。
It does imply an absolute path name pointing to the root directory in any environment, but in the context of Android, it's a convention to tell the Android run-time to say "Here, the directory www
has a file called index.html
located in the assets
folder in the root of the project".
这就是资产是如何在运行时加载,例如的WebView
插件会确切地知道在哪里指定加载嵌入的资源文件中的文件:///
URI
That is how assets are loaded at runtime, for example, a WebView
widget would know exactly where to load the embedded resource file by specifying the file:///
URI.
考虑code例如:
WebView webViewer = (WebView) findViewById(R.id.webViewer);
webView.loadUrl("file:///android_asset/www/index.html");
一个很容易犯的错误这里是这样,有些人会就推断为文件:/// android_assets
,注意资产的URI复数,不知道为什么嵌入的资源不工作!
A very easy mistake to make here is this, some would infer it to as file:///android_assets
, notice the plural of assets in the URI and wonder why the embedded resource is not working!
这篇关于是什么文件:///android_asset/www/index.html是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!