Oncreate 方法运行,它显示 Web 视图,并在应用程序运行的几毫秒内消失。
我在 stackoverflow.com 上搜索了其他类似的问题并使用相同的代码。
对不起简单的问题,但我是初学者。
private WebView webview;
private static final String TAG = "Main";
private ProgressDialog progressBar;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.launch_page);
webview = (WebView)findViewById(R.id.web_view);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
// WebSettings settings = webview.getSettings();
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return super.shouldOverrideUrlLoading(view, url);
}
});
webview.loadUrl("http://www.google.com");
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView android:id="@+id/web_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" />
</LinearLayout>
错误 07-27 15:48:27.270: E/ActivityThread(4160): Activity com.green.iyengertv.FirstLaunch 泄露了最初在此处注册的 IntentReceiver com.android.qualcomm.browsermanagement.BrowserManagement$1@4145b4d8。您是否错过了对 unregisterReceiver() 的调用?07-27 15:48:27.270: E/ActivityThread(4160): android.app.IntentReceiverLeaked: Activity com.green.iyengertv.FirstLaunch 泄露了最初在此处注册的 IntentReceiver com.android.qualcomm.browsermanagement.BrowserManagement$1@4145b4d8 . 您是否错过了对 unregisterReceiver() 的调用?