我想從asset
文件夾加載。我試着跟蹤並搜索。但是,我的文件沒有加載。它說: 「沒有可用的Web頁」Html文件不能從資產文件夾加載
這裏是我的代碼: HelpActivity.java
public class HelpActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_help);
((WebView) findViewById(R.id.webView1))
.loadUrl("file///android_asset/help.html");
}
public void closeWindow(View v) {
finish();
}
}
help.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".HelpActivity" >
<WebView
android:id="@+id/webView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</WebView>
</LinearLayout>
help.html
<html>
<body>
Hello world
</body>
</html>
我應該包括在AndroidManifest任何權限?
相同的答案......你2秒快速所以要公平競賽,我刪除了我的:) – gunar
@gunar現在這是很好的體育道德:) – CodingIntrigue
正確的答案...另一個教程是有用的在http://lomza.people.totem-soft.com/?p=62 –