Android Studio、GridLayout 在 API 低于 23 时无法正常工作

Android Studio, GridLayout not working properly on API under than 23

当我尝试在 API 上预览时 23 GridLayout 运行良好。但是,在之前的 API 21 上,它的位置错误,边距或填充也无济于事。目标 API 也是 23 minSDK API 是 15,当我尝试将目标 API 更改为 21 时,我遇到了渲染问题(无法解析文件)。 如何使应用程序与 API 23 下的 API 版本兼容?非常感谢您提供的任何帮助。

API 23:

API 21:

解决了所有问题: 1.In build.gradle(模块:app) 添加到依赖项 dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') androidTestCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.4.0' compile 'com.android.support:appcompat-v7:+' compile 'com.android.support:gridlayout-v7:23.1.+' }

2.In actvity_main.xml 更改为 <android.support.v7.widget.GridLayout>