2015-12-21 88 views
1

我有一個GridView,我需要添加一個頁腳視圖。我知道這是可能是做一個ListView使用這樣的代碼:Android GridView添加FooterView

 LinearLayout layoutFooter = (LinearLayout) getLayoutInflater().inflate(R.layout.footerview, null); 
     final ListView listView = getListView(); 
     listView.addFooterView(layoutFooter); 

但我怎麼做相同的GridViews?這種方法似乎不適用於GridView。任何想法?乾杯。

+0

你可以給RecyclerView一個試試嗎? – Blackbelt

+0

你能舉個例子嗎? – Kristo

+0

[there](https://gist.github.com/hister/d56c00fb5fd2dfaf279b)你是。 – Blackbelt

回答

-1

Here's這是一個很好的解決方案。

+0

是的,我也看到了,但是沒有圖書館可以做嗎? – Kristo

+0

@ Kristo1990是的。有可能 –

0

使用相對佈局作爲父級佈局並設置頁腳,中心和標題位置,並將網格視圖置於頁腳位置的中心位置和所需頁腳視圖。

+0

我已經試過這個,但是它總是顯示GridView頂部的按鈕。 – Kristo

+0

我應該工作你檢查了所有的視圖嗎?他們的安排。您必須在相對佈局中對齊3個線性佈局,並且網格佈局應該是中心的子佈局然後嘗試。 –