我是新的Android应用程序.我只是想知道是否有一种方法来查看一个布局内的webview?例如。
WebView webview = (WebView)findViewById(R.id.webView1);
webview.getSettings().setJavaScriptEnabled(true);
webview.getSettings().setBuiltInZoomControls(true);
String url = "Layout location or R.Layout.test";
webview.loadUrl(url);
这就像使用Activity类来查看这样的布局setContentView(R.layout.test);
我正在尝试在web视图中查看布局。
任何想法都将受到高度赞赏。
4条答案
按热度按时间brccelvz1#
无论你在教程中看到什么,我假设他们可能不会加载布局INTO
WebView
,而可能是along with
WebView
。换句话说,你实际上可以在HTML中使用类似于div的布局。你需要一个布局,在其中添加Webview,然后在Webview标签之外添加Button和其他控件,如lgw 150所示。
**这可能给予人的印象,按钮等是在webview内,但他们实际上不是!**你可以有这样的东西:
更多信息请查看this和this too。
t98cgbkg2#
在webview中查看布局?我不是很明白,下面可能是一个例子给你
nr9pn0ug3#
需要说明的是,Web视图不能用于加载布局。
检查此链接
http://developer.android.com/reference/android/webkit/WebView.html
vd8tlhqk4#
不你不能编译的应用程序不包含资源XML。它被转换为内部格式:
http://www.atcomm.com.au/Atcomm-Underground/Java/Compiled-and-Noncompiled-Android-Resources.html
http://developer.android.com/tools/building/index.html