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域名
本文介绍在API level小于21时,如何通过导入兼容包实现GridLayout中的平均行和列。主要步骤包括修改build.gradle文件引入兼容包、调整XML文件命名空间及使用兼容包下的GridLayout等。
4218

被折叠的 条评论
为什么被折叠?



