解決: 建立一個繼承 GridView 的 Class, 然後覆寫 onMeasure event :
程式碼
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightSpec = heightMeasureSpec;
if (getLayoutParams().height == LayoutParams.WRAP_CONTENT)
heightSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE, MeasureSpec.AT_MOST);
super.onMeasure(widthMeasureSpec, heightSpec);
}
參考網址: http://www.jayway.com/2012/10/04/how-to-make-the-height-of-a-gridview-wrap-its-content/
參考看看囉 ^^