Vì vậy, tôi đã sao chép điều này ví dụ hướng dẫn ngay từ trang web Android của Google và tôi nhận được một lỗi rằng R.id không thể được giải quyết.R.id không thể được giải quyết
Đây là tập tin Java của tôi
package com.TestApp.HelloWebView;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;
public class HelloWebView extends Activity {
WebView mWebView;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
}
}
Đây là res/layout/main.xml
<?xml version="1.0" encoding="utf-8"?>
<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
Kể từ SDK Android mới, không cần nhập rõ ràng com.TestApp.R. Eclipse tự động giải quyết nó. –