【发布时间】:2014-02-26 22:31:58
【问题描述】:
我正在尝试将 Web 视图显示为列表视图的页脚。
将脚本添加到 html 文件并放置在 assets 文件夹中 使用 Web 视图创建布局 将网页视图作为页脚放置,但我看不到网页视图
WebView 布局:
<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>
assets文件夹中的html文件:
<html>
<body>
<div id="ym_1234" 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>
</body>
</html>
我添加页脚的片段代码:
ListView list = (ListView)view.findViewById(android.R.id.list);
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().setJavaScriptEnabled(true);
web.setWebViewClient(new WebViewClient());
web.loadUrl("file:///android_asset/news_footer.html");
list.addFooterView(listFooterView);
我只能看到列表,但看不到页脚中的 web 视图
【问题讨论】:
标签: android html android-listview android-webview