GridLayout v7无法实例化(使用Eclipse)

时间:2013-12-23 11:17:54

标签: android eclipse grid-layout

我收到以下消息:

  

无法实例化以下类:    - android.support.v7.widget.GridLayout(Open Class,Show Error Log)

所以我寻找解决方案,我发现:

  1. Setting up Android support package v7 for eclipse - GridLayout无效
  2. Gridview v7 support for older api android.support.v7.widget.Gridlayout failed to instaniate无效
  3. Eclipse giving an error of android.support.v7.widget.GridLayout failed to instantiate无效
  4. 是的,这些解决方案都不适合我......

    这是layout.xml,非常简单:

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
    </android.support.v7.widget.GridLayout>
    

    最低API为10.

    感谢。

1 个答案:

答案 0 :(得分:2)

试试如下:

File->Import->Existing Android code into workspace指定android-sdk-[platform]/extras/android/support/v7/gridlayout并在工作区中添加GridLayout的项目库。

将库导入工作区后,您需要将GridLayout库项目导入为项目中的Android库项目,以使其正常工作。

编辑:对于遇到此问题的所有人,请尝试更新android-support-v4.jar。