我一直在尝试这一整个晚上都无济于事,所以我要从头开始列出我的确切步骤。为eclipse设置Android支持包v7 - GridLayout
- 我已经安装了通过SDK管理器支持包。
- 我创建了一个新的android项目,我称之为“testinggridlayout”。
- 构建目标我选择的是Android 2.1 API 7
- 列表项
这将是我的项目,我希望能够创建一个网格 布局。
要建立支持包这些是我的步骤:
- 右键单击我刚刚创建的项目,并选择 - 新 - 的Android项目
- 将它命名为网格布局,并选择从现有的源 创建项目,请浏览:
android-sdks\extras\android\support\v7\gridlayout
- 右键单击我的
testinggridlayout
项目,然后单击属性: - 下Java构建路径 - 选择项目选项卡,然后添加。
- 选择我的项目“GridLayout”,然后单击确定,然后确定。
此时
如果我进入的main.xml布局手动插入此代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<GridLayout
android:background="#FFFFFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:columnCount="8"
android:rowCount="5" >
</GridLayout>
</LinearLayout>
我得到的错误:
The following classes could not be found: - GridLayout (fix build path, edit XML).
如果我改变
<GridLayout> & </GridLayout>
到
<android.support.v7.widget.GridLayout> & </android.support.v7.widget.Gridlayout>
我收到了同样的错误:
The following classes could not be found: - android.support.v7.widget.GridLayout (fix build path, edit XML).
在这一点上我创造了我的项目被称为“库”的文件夹。
然后,我将GridLayout项目中的libs下的android-support-v7-GridLayout.jar文件复制到此文件夹中。
我在“testinggridlayout”的“libs”文件夹中右键单击了该文件,并选择了“添加到构建路径”。然后
我的错误更改为:
The following classes could not be instantiated: - android.support.v7.widget.GridLayout (open class, show error log)
哪个位(S)我已经错过了/不应该做?
对我来说,日食要求安装支持包,但还是没”不承认它。对我来说,只是使用Android.support.v7.widget.GidLayout修复它。谢谢! – Niels 2012-11-03 23:24:45