API level 小于21时,如果需要实现各行或个列实现平均行和列,需要导入兼容包,具体步骤如下:
1)找到对应module下的build.gradle文件,在denpendencies模块中加入 compile 'com.android.support:gridlayout-v7:23.0.0' 以导入兼容包
2)在xml文件中,头部加入 xmlns:app="http;//schemas.android.com/apk/res-auto"
3)使用GridLayout时调用兼容包下的GridLayout,即
<android.support.v7.widget.GridLayout></android.support.v7.widget.GridLayout>
4)使用layout_columnWeight或layout_rowWeight时使用app域名