當我嘗試使用android上的web視圖填充它時,出現空白屏幕。 該程序運行時出錯,但我得到一個空白屏幕。 我在使用sdk 1.6並在模擬器中運行它無法讓網絡視圖在Android上運行sdk 1.6
代碼 package mikenorman.org;
import android.app.Activity;
import android.view.*;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
public class cBlog extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.blog);
WebView mWebView;
mWebView=(WebView) findViewById(R.id.bwebpage);
mWebView.loadUrl("http://www.besttechsolutions.biz");
}
佈局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<WebView
android:id="@+id/bwebpage"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
/>
}} -Ted
wv.getSettings()。setJavaScriptEnabled(true); 是在您的web視圖中啓用JavaScript的命令,如果需要的話。 – FoamyGuy