在gridLayout上动态添加button按钮
二维数组用于button上显示的内容
具体代码:
public class CityActivity extends Activity {
GridLayout gridLayout=(GridLayout) findViewById(R.id.hot_city_gridlayout);
String[][] count = { { "北京", "上海", "天津", "哈尔滨" }, { "沈阳", "深圳", "广州", "重庆" }, { "广州", "香港", "厦门", "南京" } };
private void setHotCityGridLayout() {
GridLayout.LayoutParams params = null;
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 4; j++) {
final Button btn = new Button(this);
btn.set