-1

我正在尝试通过 ActionBarSherlock 在我的项目中使用 StaggeredGridView。但是当我尝试将 main_screen.xml 膨胀到 main.xml 时出现此错误。

View view = inflater.inflate(R.layout.main_screen, container, false);

启动我的应用程序时出现以下日志错误:

Could not find class 'android.support.v4.util.SparseArrayCompat', referenced from method com.origamilabs.library.views.StaggeredGridView
 E/AndroidRuntime(18115): FATAL EXCEPTION: main
E/ndroidRuntime(18115): android.view.InflateException: Binary XML file line #8: Error inflating class com.origamilabs.library.views.StaggeredGridView
03-05 12:28:17.565: E/AndroidRuntime(18115):    at android.view.LayoutInflater.createView(LayoutInflater.java:626)
03-05 12:28:17.565: E/AndroidRuntime(18115):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702)
03-05 13:32:06.160: E/AndroidRuntime(22619):    at com.deu.sharepic.MainScreenActivity.onCreateView MainScreenActivity.java:84)

还有我的 main_screen.xml ;

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:staggered="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent" >

 <com.origamilabs.library.views.StaggeredGridView
android:id="@+id/chatList"
staggered:numColumns="2"
staggered:drawSelectorOnTop="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" /> 

</RelativeLayout>

和 main.xml :

<android.support.v4.view.ViewPager
 xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
 android:layout_height="match_parent" />
4

1 回答 1

1

我更改了所有使用示例项目 v4.jar 的引用项目中的所有 andoid_support_v4.jar。比删除 staggeredgridview.jar 并添加为库项目。比固定。

谢谢大家。

于 2015-03-07T19:01:42.533 回答