1
如果可能,如何在我的MainActivity.java类文件中仅使用代码将web视图添加到布局中。通过MainActivity添加webview
如果可能,如何在我的MainActivity.java类文件中仅使用代码将web视图添加到布局中。通过MainActivity添加webview
WebView webView = new WebView(this);
*setting up webview*
setContentView(webview);
或
ViewGroup yourLayout = (ViewGroup) LayoutInflater.from(this).inflate(R.layout.your_layout, null);
setContentView(yourLayout);
WebView webView = new WebView(this);
*setting up webview*
yourLayout.addView(webView);