我一直在嘗試這一整個晚上都無濟於事,所以我要從頭開始列出我的確切步驟。爲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