我尝试在我的应用程序中使用 GridLayout,但它不起作用。
我使用了这个教程:IntelliJ 和 android.support.v7.widget.GridLayout https://stackoverflow.com/questions/12468606/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>
今天我一直在努力解决这个问题安卓开发网站 http://developer.android.com/tools/support-library/features.html我找到了更简单的解决方案以及为什么他们会遇到问题。 v7 库中的 GridLayout 未与 v7 appcompat 库连接,因此您必须手动添加 v7 gridlayout 库依赖项。
如果你使用 gradle 然后在build.gradle
只需添加
dependencies {
...
compile 'com.android.support:gridlayout-v7:23.2.0'
}
一切都应该正常:)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)