我想在网页浏览中显示以下脚本:
<div id="hello_43211234" class="ym"></div>
<script type="text/javascript">(function(e,t){if(t._ym===void 0){t._ym="";var m=e.createElement("script");
m.type="text/javascript",m.async=!0,m.src="//static.yieldmo.com/ym.min.js",(e.getElementsByTagName("head")[0]||e.getElementsByTagName("body")[0]).appendChild(m)}else t._ym instanceof String||void 0===t._ym.chkPls||t._ym.chkPls()})(document,window);
</script>
我尝试将脚本放在html中 - 在正文中
<html>
<body>
Script
</body>
</html>
我将Web视图作为页脚添加到列表中(要注意我尝试将textview添加为页脚,我能够看到文本视图):
WebView web;
LayoutInflater inflaterOf = getActivity().getLayoutInflater();
LinearLayout listFooterView = (LinearLayout)inflaterOf.inflate(com.philly.prosportsframework.R.layout.list_with_footer, null);
web = (WebView)listFooterView.findViewById(R.id.webview_footer);
web.getSettings().setLoadWithOverviewMode(true);
web.getSettings().setUseWideViewPort(true);
web.getSettings().setJavaScriptEnabled(true);
web.getSettings().setPluginState(PluginState.ON);
//wv.getSettings().setAllowContentAccess(true);
web.getSettings().setSupportMultipleWindows(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web.getSettings().setDomStorageEnabled(true);
web.setWebChromeClient(new WebChromeClient());
web.loadUrl("file:///android_asset/my_page.html");
list.addFooterView(listFooterView);
网络视图的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<WebView
android:id="@+id/webview_footer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>