2014-02-26 43 views
0

我想顯示Web視圖作爲列表視圖的頁腳。Android - Webview作爲列表視圖頁腳不工作

添加腳本的HTML文件,並放在創建與Web視圖 佈局資產文件夾 放置在網頁視圖頁腳,但我不能看到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> 

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視圖是沒有看到

回答

0

一個快速的問題....是ü添加腳註?

list.addFooterView(listFooterView); 
list.setAdapter(adapter); 

它不能從您的代碼讀取...

+0

我試圖設置文本視圖頁腳和它的工作,我能看到它。然後,我將textview佈局的位置更改爲Web視圖佈局。我只粘貼了添加頁腳的代碼 –

+0

ok ...所以我創建了我簡單的應用程序,以查看它是否甚至可以在頁腳中顯示webview,並發現它是...也嘗試使用視圖,而不是線性佈局...如果它不工作,然後嘗試使用void addFooterView(視圖v,對象數據,布爾isSelectable) –