【发布时间】:2016-03-07 19:18:40
【问题描述】:
我尝试在我的应用程序中使用 GridLayout,但它不起作用。 我使用了这个教程:IntelliJ and android.support.v7.widget.GridLayout
但还是不行。
我收到以下错误:
error: No resource identifier found for attribute 'columnCount' in package 'android'
error: No resource identifier found for attribute 'rowCount' in package 'android'
还有什么建议吗?
编辑: 使用我的实际 XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:grid="http://schemas.android.com/apk/res-auto"
android:layout_width="350dp"
android:layout_height="fill_parent"
android:orientation="vertical">
<EditText android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:cursorVisible="false"
android:id="@+id/txtName"/>
<android.support.v7.widget.GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
grid:columnCount="3"
grid:rowCount="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1,1" />
</android.support.v7.widget.GridLayout>
</LinearLayout>
【问题讨论】:
-
发布您的完整布局——您是否定义了 android 命名空间?另外,您的 API 目标是什么?
-
我编辑了我的 xml。我使用 Google 2.2 API
-
尝试将属性命名空间改回android。
-
您是如何将 v7 兼容库添加到您的项目中的?你是粘贴 jar 还是使用 Gradle?
标签: android grid-layout