我正在eclipse上處理這個android項目。我在主要活動上創建了兩個gridLayouts和一個文本字段。它繼續在窗口中顯示此警告「以下類無法實例化: - android.support.v7.widget.GridLayout(打開類,顯示錯誤日誌)」,但當我嘗試添加一個按鈕到GridLayout,活動凍結,現在它顯示以下消息「注意:此項目包含Java編譯錯誤,這可能會導致自定義視圖呈現失敗。首先修復編譯問題。渲染過程中引發的異常:com.android.layoutlib.bridge.MockView不能轉換爲android.view.ViewGroup
在呈現過程中引發異常:com.android.layoutlib.bridge。 MockView不能轉換爲android.view.ViewGroup 在窗口>顯示視圖>錯誤日誌中記錄異常詳細信息 以下類無法實例化: - android.support.v7.widget.GridLayout(Open Class,Show Error Log )「我的xml文件是:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0099cc"
tools:context=".MainActivity"
xmlns:app="http://schemas.android.com/apk/res/com.example.simple_calculator">
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="94dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<android.support.v7.widget.GridLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="232dp"
android:layout_marginTop="100dp" >
</android.support.v7.widget.GridLayout>
<android.support.v7.widget.GridLayout
android:layout_width="232dp"
android:layout_height="match_parent"
android:layout_marginTop="100dp"
app:columnCount="1" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_column="0"
app:layout_gravity="left|top"
app:layout_row="0"
android:text="Button" />
</android.support.v7.widget.GridLayout>
</FrameLayout>
我已經嘗試導入android-sdk- [platform]/extras/android/support/v7/gridlayout,但仍然出現同樣的錯誤。