0
如何通過動態控制動態的單元格大小gridview
來調整單元格的大小以獲取wrap_content
?Android動態網格視圖
ArrayAdapter<String> adp = new ArrayAdapter<String> (this, android.R.layout.simple_dropdown_item_1line, list);
grid.setNumColumns(8);
grid.setBackgroundColor(Color.GRAY);
grid.setColumnWidth(100);
//grid.setFastScrollEnabled(true);
grid.setOverScrollMode(View.OVER_SCROLL_IF_CONTENT_SCROLLS);
//grid.getMeasuredWidth();
grid.setMinimumWidth(100);
grid.setHorizontalFadingEdgeEnabled(true);
grid.setAdapter(adp);
balance_layout.addView(grid);
http://stackoverflow.com/questions/5690144/how-can-i-force-a-gridview-to-use-the-whole-screen-regardless-of-display-size閱讀本主題,它可能會提供一些答案 –