解决GridLayout API level小于21时平均分配行列的问题

来源:互联网 发布:西溪悦榕庄 知乎 编辑:程序博客网 时间:2024/06/08 11:55

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域名

0 0
原创粉丝点击