GridLayout崩溃问题

写类似朋友圈界面的时候有九宫格,2*2的图片展示,用的gridlayout,运行的时候会崩溃,报错如下

java.lang.IllegalArgumentException: columnCount must be greater than or equal to the maximum of all grid indices (and spans) defined in the LayoutParams of each child. 

记得在setColumnCount 或者setRowCount之前 

  gridLayout.removeAllViews();

  

原文地址:https://www.cnblogs.com/fatherloveyou/p/10593413.html