当我尝试使用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