Java 未找到Woxblom DragListView类异常DragItemRecyclerView
我尝试使用在上找到的DragListView 我将包复制到我的项目中,将文件android-support-v7-recyclerview.jar导入到我的项目中,并将该文件添加到构建路径中的我的库中 目前,我的活动仅设置以下视图:Java 未找到Woxblom DragListView类异常DragItemRecyclerView,java,android,android-recyclerview,Java,Android,Android Recyclerview,我尝试使用在上找到的DragListView 我将包复制到我的项目中,将文件android-support-v7-recyclerview.jar导入到我的项目中,并将该文件添加到构建路径中的我的库中 目前,我的活动仅设置以下视图: public class CreateGameActivity extends ModuleSettingsActivity { @Override protected void onCreate(Bundle savedInstanceState
public class CreateGameActivity extends ModuleSettingsActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_game);
}
}
activity_create_game.xml如下所示:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.gameengine.CreateGameActivity"
android:orientation="vertical" >
<com.woxthebox.draglistview.DragListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drag_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
运行应用程序会导致以下错误:
03-04 15:43:30.201:E/AndroidRuntime(25082):java.lang.RuntimeException:无法启动活动
ComponentInfo{com.schockenpro/com.gameengine.CreateGameActivity}:android.view.InflateException:二进制XML文件行#2:错误:对类com.woxthebox.draglistview.DragItemRecyclerView进行膨胀
我发现这通常是由于缺少jar文件造成的。根据这个问题,我如上所述导入了jar文件,但错误仍然存在。我发现,我以错误的方式添加了recyclerview的库(不是通常的库) 首先,我从recyclerview.jar(位于android/sdk/extras/android/support/v7/recyclerview/libs)文件中创建了一个库项目,并将其作为现有项目导入。 第二,我将库添加到我的项目中,然后错误就消失了 通常添加罐子的方法在这里不起作用